saltstack/salt — pull request #10669 by borgstrom (2014-02-22 14:01:35+00:00)
Title: Provide the loaded states to renderers

As @mgwilliams has been using pyobjects more he's discovered that when
we load the list of states inside the renderer we need to provide the
pillar & grain data so that it's available to the modules or we get
exceptions like the following.

```
ID: ls
Function: cmd.run
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1371, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/states/cmd.py", line 598, in run
'shell': shell or __grains__['shell'],
KeyError: 'shell'
Changes:
```

We also reasoned that invoking the state loader on every single render
of an sls file is a bit excessive and it would be better to simply have
the already loaded list of states provided to the renderer modules.

The original patch: https://gist.github.com/mgwilliams/f5f7cf1da30e5931e6dc