kitchen-salt
kitchen-salt copied to clipboard
Allow using `top.sls` pillar from file
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.
seems reasonable
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.
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.
You get the point :)