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

Unable to render /etc/salt/minion.d/reactor.conf #317

Closed
rhertzog opened this issue Jun 8, 2017 · 7 comments
Closed

Unable to render /etc/salt/minion.d/reactor.conf #317

rhertzog opened this issue Jun 8, 2017 · 7 comments

Comments

@rhertzog
Copy link
Contributor

rhertzog commented Jun 8, 2017

I get this error:

          ID: salt-minion
    Function: file.recurse
        Name: /etc/salt/minion.d
      Result: False
     Comment: #### /etc/salt/minion.d/reactor.conf ####
              Unable to manage file: Problem running salt function in Jinja template: default must be a dictionary or None when merge=True; line 6
              
              ---
              #
              # This file is managed by Salt! Do not edit by hand!
              #
              {# The parameter reactor is kept for backward compatibility -#}
              {%- set reactors = salt['pillar.get']('salt:reactor', []) -%}
              {%- set reactors = salt['pillar.get']('salt:reactors', default=reactors, merge=True) -%}    <======================
              {%- set reactors = salt['pillar.get']('salt:minion:reactors', default=reactors, merge=True) -%}
              
              {%- if reactors %}
              reactor:
                {%- for reactor in reactors %}
              [...]

It seems to be caused by 561eb4c by @javierbertoli ... the change looks wrong.

@javierbertoli
Copy link
Member

Hi @rhertzog , reactor and/or reactors should be lists. Am I wrong, or does it seem you're using a dict in reactors, and that's why it's failing?

The line before the one you point, sets the variable reactors to a list (as the default for the formula before the commit you mention used lists for reactor. See the diff for the pillar.example file), so when the line you point tries to merge the dict in salt['pillar.get']('salt:reactors with the list in default=reactors set in the previous line, it fails.

Do I make sense, or am I missing something?

What do you have in your pillar for these parameters?

@rhertzog
Copy link
Contributor Author

rhertzog commented Jun 8, 2017

I don't have any pillar value for salt:reactor or salt:reactors on the minion where I got the above error... and the error is rather clear, you can't use a list for the default parameter if you use merge=True. Your commit changed the "None" value I used to have into an empty list, thus the failure.

@rhertzog
Copy link
Contributor Author

rhertzog commented Jun 8, 2017

If you look at the engines, beacons, and other similar parameter, they are all true dictionaries in their syntax and using merge=True is thus not a problem. Here for reactors, you have a list of single-key dictionaries. It looks like using merge=True is not an option.

javierbertoli added a commit to netmanagers/salt-formula that referenced this issue Jun 9, 2017
@javierbertoli
Copy link
Member

@rhertzog, does the PR #318 fix the issue for you? Any change or comments about it?

@rhertzog
Copy link
Contributor Author

rhertzog commented Jun 9, 2017

@javierbertoli Yes, it works. Obviously you get the union of all the reactors but that's okay, we did not really want any override logic I think.

@javierbertoli
Copy link
Member

Yeah. First I thought of overriding them, but then I thought that a single beacon might have different reactors for different hosts, and that you'd like to specify them in different places and adding them.

OK, thanks for pointing the error and sorry for the inconveniences. @aboe76, mind you merge that PR?

aboe76 added a commit that referenced this issue Jun 9, 2017
@aboe76
Copy link
Member

aboe76 commented Jun 9, 2017

@javierbertoli merged it

@rhertzog rhertzog closed this as completed Jul 4, 2017
nareshov pushed a commit to rocket-labs-sysadmins/salt-formula that referenced this issue Sep 25, 2017
daveneeley pushed a commit to SpillmanTech/salt-formula that referenced this issue Feb 22, 2019
…m feature/upstream-merge-2017-07-19 to master

* commit '2c3d51b3be17b07e6612585a41930da45ec5034f': (103 commits)
  enable the syndic service
  Fix lists join error (saltstack-formulas#317)
  Update comment for consistency
  Remove "source" comments from Saltify configs
  fix map.jinja
  add a way to set which release of saltstack to use
  Exclude reactors from f_defaults.conf
  Fix reactor examples
  Reactors should be in an array
  Allow to specify different reactors for minions and masters
  Fix rendering of external_auth config.
  Do not sync salt-cloud provided default configuration by default
  Rework salt-cloud directories and files creation
  Compact salt-cloud pip.installed instructions
  Simplify logic
  Wrong list name in config file
  Updated master and minion default config files
  add syndic_user option in the master config
  User publisher_acl setting in salt master config even if used client_acl in pillar (backwards compatibility)
  fix salt master config template to use external_auth settings
  ...
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

No branches or pull requests

3 participants