The issue with using environments in my current setup is that my schedules are defined in the config file, not in pillars, so I could end up automatically running my dev environment against a production node by accident.
Again, the use-case is testing new code on production systems. I want to be able to run state.highstate test=True against a new branch on a production node without risking that my schedules kick in and actually run the new branch with side effects.
I think one solution is to dynamically define the environment based off of a grain (maybe a file or some-such), and then put the schedule back into a pillar. Something like this:
pillar/top.sls:
------------------
'base':
'*':
schedule:
highstate:
function: state.highstate
minutes: 60
'test':
'*':
schedule: {}
master config:
---------------------
file_roots:
base:
- /srv/salt/
test:
- /srv/salt/checkout_on_another_branch
top.sls
----------
base:
'*':
- somestate
test:
'env:test':
- match: grain
Would that work? Wouldn't somestate.sls still come off of the base tree? Also, I would need to restart the minion for this to take affect, because the grain would be cached, and so salt wouldn't notice when I change the file. Can anybody think of a more elegant solution?