Repository navigation
Closed
Labels
Corerelates to code central or existential to Saltbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Description
# salt-call --versions
Salt: 2014.7.0-1596-g5586c20
Python: 2.7.3 (default, Mar 13 2014, 11:03:55)
Jinja2: 2.6
M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.6
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 13.1.0
RAET: Not Installed
ZMQ: 3.2.3
Mako: Not Installed
Git (based on 2014.7 branch): https://github.com/bechtoldt/salt/tree/2014.7-arbe
# cat /etc/salt/minion
master: 127.0.0.1
log_level: debug
# cat /etc/salt/master
file_roots:
prod:
- /srv/salt/prod/
pillar_roots:
base:
- /srv/pillar
pillar_opts: False
# cat /srv/salt/prod/top.sls
prod:
'*':
- test_state
# cat /srv/salt/prod/test_state.sls
test:
file:
- managed
- name: /var/tmp/test_file
- contents: |
{{ salt['pillar.items']() }}
# cat /srv/pillar/top.sls
base:
'*':
- test
# cat /srv/pillar/test.sls
foo: bar
# tree /srv/
/srv/
├── pillar
│ ├── test.sls
│ └── top.sls
└── salt
└── prod
├── test_state.sls
└── top.sls
3 directories, 4 files
# rm -f /var/tmp/test_file
# salt '*' state.sls test_state saltenv=prod
ipm1039:
----------
ID: test
Function: file.managed
Name: /var/tmp/test_file
Result: True
Comment: File /var/tmp/test_file updated
Started: 19:54:37.940317
Duration: 2.514 ms
Changes:
----------
diff:
New file
Summary
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
# cat /var/tmp/test_file
{'foo': 'bar'}
# salt '*' state.highstate saltenv=prod
ipm1039:
----------
ID: test
Function: file.managed
Name: /var/tmp/test_file
Result: True
Comment: File /var/tmp/test_file updated
Started: 19:54:53.186957
Duration: 2.467 ms
Changes:
----------
diff:
---
+++
@@ -1 +1 @@
-{'foo': 'bar'}
+{}
Summary
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
# cat /var/tmp/test_file
{}
Metadata
Metadata
Assignees
Labels
Corerelates to code central or existential to Saltbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Activity
steverweber commentedon Feb 8, 2015
try - contents: {{ pillar|json }}
steverweber commentedon Feb 8, 2015
fyi i think pillar_opts: False is the default now
steverweber commentedon Feb 8, 2015
one other thing... give it a
salt minion saltutils.refresh_pillarsalt minion pillar.rawarnisoph commentedon Feb 8, 2015
steverweber commentedon Feb 8, 2015
Yap something is wrong here!
steverweber commentedon Feb 8, 2015
where is the pillar for prod?
arnisoph commentedon Feb 8, 2015
@steverweber no worries, now I'm sure I'm not crazy (yet)
steverweber commentedon Feb 8, 2015
if i were you i would start with everything in base.
also perhaps try the latest release of salt to see if this issue was solved.
[-]Pillar access in state.sls and state.highstate differs[/-][+]Pillar access in state.highstate seems to be unavailable[/+][-]Pillar access in state.highstate seems to be unavailable[/-][+]Pillar access during state.highstate seems to be unavailable[/+]arnisoph commentedon Feb 8, 2015
FACEPALM
So what the heck is state.highstate() doing with saltenv?
[-]Pillar access during state.highstate seems to be unavailable[/-][+]Pillar access during state.highstate seems to be unavailable when setting saltenv arg[/+]rallytime commentedon Feb 9, 2015
Thanks for the report @bechtoldt, and for the responses @steverweber.
I am not entirely sure if
state.highstatewas designed to do anything withsaltenvsince by definitionhighstateis cross-environment.arnisoph commentedon Feb 10, 2015
@rallytime I agree, setting the saltenv arg does not make sense when using state.highstate.
But the interesting part starts in the code: https://github.com/saltstack/salt/blob/develop/salt/modules/state.py#L461
basepi commentedon Feb 10, 2015
Interesting, we'll have to investigate if the saltenv is actually doing anything inside of the HighState class.
basepi commentedon Feb 10, 2015
Wait, so I'm confused about this issue. Is this issue about
state.highstateorstate.slswithsaltenv? Your original example makes me thinkstate.sls, but the title and last few comments say otherwise.arnisoph commentedon Feb 19, 2015
@basepi as @rallytime already stated
state.highstatewas meant.state.highstateusessaltenvfor a purpose I don't understand:salt/salt/modules/state.py
Line 481 in 1e36cbb
pruiz commentedon Feb 24, 2015
Well, I for example tend to use "state.highstate test=true saltenv=GIT_BRANCH_XYZ" as a way to test application of states from a git branch on our salt states repository.
This is a really useful pattern, but not having access to pillars, kills it.. :(
pruiz commentedon Feb 24, 2015
Even this 'hackish' way does not work either:
pruiz commentedon Feb 24, 2015
Turns out pillar.items/pillar.raw returns a dict with a single key (local) even when outputing as json, so I had to relay on an even more 'hackish way' to get it to work:
But at least, it works.. ;)
arnisoph commentedon Jul 11, 2015
I'm closing this since
saltenvisn't a supported argument.