-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix master_tops configuration rendering #313
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this on my salt-master no problems found,
running:
master_tops:
varstack: /srv/stack/varstack.yaml
@0xf10e could you take a look please otherwise I merge this. |
Sorry, @aboe76, missed your request for review there.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove the elif
for strings and I'm fine with this change.
{%- for parameter in cfg_master['master_tops'][master] %} | ||
{{ parameter }}: {{ cfg_master['master_tops'][master][parameter] }} | ||
{%- endfor -%} | ||
{%- endif -%} | ||
{%- elif cfg_master['master_tops'][master] is string %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for a separate test for string
. Just let the else
handle all the scalar types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xf10e , I also though like this initially, but it wasn't correct, because string is iterable, so the behaviour was not the expect one.
I think that the correct configuration can be created only if the string is treated before other iterable items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xf10e what is your opinion ?
merging this, tested with without the string match, and indeed it causes weird behaviors. |
When you add a custom master top to the saltmaster configuration the master.sls state will fail if the config looks like:
This happens because it wil not treat the situation when you have a boolean as a value for the customtop.
See also:
https://docs.saltstack.com/en/latest/topics/master_tops/index.html
My change consists in checking for all possible values and apply the state accordingly.