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

Allow using top.sls pillar from file #225

Open
Lirt opened this issue Apr 10, 2018 · 4 comments
Open

Allow using top.sls pillar from file #225

Lirt opened this issue Apr 10, 2018 · 4 comments
Milestone

Comments

@Lirt
Copy link

Lirt commented Apr 10, 2018

Hello,

I tried to specify top.sls pillar from file but did not success. Let's say this is usual way people define pillars in suites or provisioner:

provisioner:
  name: salt_solo
  formula: dns
  salt_install: bootstrap
  salt_version: 2018.3.0
  require_chef: false
  state_top:
    base:
      '*':
        - dns
suites:
  - name: default
    provisioner:
      pillars:
        top.sls:
          base:
            '*':
              - dns

Now I would like to use top.sls pillar from file. The code I tried is this:

provisioner:
  name: salt_solo
  formula: dns
  salt_install: bootstrap
  salt_version: 2018.3.0
  require_chef: false
  state_top:
    base:
      '*':
        - dns
suites:
  - name: default
    provisioner:
    pillars-from-files:
      top.sls: test/integration/default/top.sls

This example ends with this error:

Preparing pillars into /srv/pillar
Failed to complete #converge action: [undefined method `each' for nil:NilClass] on default-ubuntu-1604

I tried to diagnose with kitchen diagnose --all, but there was nothing helpful in the log. I expected that top.sls file I included in pillars-from-files will be copied into /srv/pillar and everything will work well.

Please, let me know if you need more information to troubleshoot this or if this is actually not implemented or if I am using it wrong.

@gtmanfred gtmanfred added this to the Approved milestone Mar 1, 2019
@gtmanfred
Copy link
Contributor

seems reasonable

@daks
Copy link
Contributor

daks commented Mar 4, 2019

I'm not sure that pillars-from-files can be used to generate the top.sls, but you can use it to generate a pillar sls file and then include it in your pillar top.sls, something like

provisioner:
  pillars:
    top.sls:
       base:
        "*":
          - dns
    
suites:
  - name: default
    provisioner:
    pillars-from-files:
      dns.sls: test/integration/default/top.sls

I use that here https://github.com/daks/usersandgroups-formula/blob/master/kitchen.yml and it works well.

@Lirt
Copy link
Author

Lirt commented Mar 5, 2019

I think I get your point.

This issue is quite old, but I think that this was what I wanted to achieve (to not define pillar variables in kitchen-salt configuration, but load them from file).

So in the suite you define the name of the pillar and path to this pillar. Then in provisioners->pillars you specify the pillar file name and the reference works, yes?

The issue in my code was, that in suites I didn't define name dns in dict ['pillars-from-files'], but name top.sls, but also, that I didn't define top.sls pillar in provisioner?

Maybe we could include some small example of loading pillars from files in docs. The usage seems a little confusing.

Edit: I can see it in documentation now.

I think we can close this. Thank you for responses.

@daks
Copy link
Contributor

daks commented Mar 5, 2019

You get the point :)

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

No branches or pull requests

3 participants