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

Data / Dicts from included pillar files are not directly usable / available in for loops? #29755

Closed
michaelkarrer81 opened this issue Dec 16, 2015 · 1 comment
Labels
Duplicate Duplicate of another issue or PR - will be closed
Milestone

Comments

@michaelkarrer81
Copy link

I import some pillar files in an other pillar file with:

# /srv/pillar/pgsql.sls
{% set instance_files = salt.cmd.run('find /srv/pillar/instances -maxdepth 1 -type f -iname "*.sls" -printf "%f\n"').split() %}
include:
  {% for file in instance_files %}
      - instances.{{ file|replace(".sls", "") }}
  {% endfor %}

The importet pillar files all have the same structure:

# /srv/pillar/instances/20000_dadi.sls
instances:
  dadi:
    port: 20000
    online:
      odoo_master_pw: 12345
      odoo_admin_pw: admin#1
      linux_pw: admin#1
      database_pw: admin#1
    studio:
      admin_pw: admin#2

Now i want to iterate through the imported and merged dict "instances" but this seems not possible:

# /srv/pillar/pgsql.sls
postgres:
  # Create the database user per instance
  users:
{% for instance in salt.pillar.get('instances') %}
    {{ instance }}:
      ensure: present
      password: {{ instance }}
      createdb: False
      createroles: False
      createuser: False
      inherit: True
      replication: False
{% endfor %}

I seems that the dictionary is not yet available? Is this a chicken egg problem or did i simply misunderstand how to correctly use the dict from the imported pillar files?

@jfindlay jfindlay added the Duplicate Duplicate of another issue or PR - will be closed label Dec 17, 2015
@jfindlay jfindlay added this to the Approved milestone Dec 17, 2015
@jfindlay
Copy link
Contributor

@michaelkarrer81, thanks for the report. This is basically a duplicate of #6955.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Duplicate of another issue or PR - will be closed
Projects
None yet
Development

No branches or pull requests

2 participants