Skip to content
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

Merged
merged 1 commit into from
Aug 13, 2017

Conversation

iondulgheru
Copy link
Contributor

@iondulgheru iondulgheru commented May 24, 2017

When you add a custom master top to the saltmaster configuration the master.sls state will fail if the config looks like:

master_tops:
  customtop: True

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.

Copy link
Member

@aboe76 aboe76 left a 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

@aboe76 aboe76 requested a review from 0xf10e May 24, 2017 20:02
@aboe76
Copy link
Member

aboe76 commented Jun 3, 2017

@0xf10e could you take a look please otherwise I merge this.

@0xf10e
Copy link
Contributor

0xf10e commented Jun 4, 2017

Sorry, @aboe76, missed your request for review there.

I think the is mapping test is still not available on CentOS /RHEL 6 (unless someone added a custom one). This change will probably break rendering this configuration file on those platforms - which will be supported until 2020.
(The master part is broken for CentOS 6 since late 2015 anyway, see #193 & #298)

Copy link
Contributor

@0xf10e 0xf10e left a 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 %}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aboe76 , @0xf10e any feedback? As I said, removing the elif for the string will lead to an unexpected behaviour.

Copy link
Member

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 ?

@aboe76 aboe76 merged commit d6389b8 into saltstack-formulas:master Aug 13, 2017
@aboe76
Copy link
Member

aboe76 commented Aug 13, 2017

merging this, tested with without the string match, and indeed it causes weird behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants