saltstack/salt — pull request #2472 by ryanschneider (2012-11-07 03:45:33+00:00)
Title: Add template support to cp.get_file paths

Here's a much smaller scoped Pull Request than the x509 stuff. :)

The goal of this change is to allow cp.get_file paths to be templated, so that minions can grab unique files without having to send a unique cp.get_file command to each minion.

Basically, this allows one to run:

```bash
salt '*' cp.get_file "salt://{{grains.cpuarch}}/vimrc" /etc/vimrc template=jinja
```

To grab your vimrc that's custom tailored to your CPU arch.. :)

[ We're using this in our environment in conjunction with custom grains to distribute some custom job information to different minions with a single cp.get_file command rather than using a series of commands with different targets ]

Both the source and destination names are 'rendered' using the template engine passed in.

Currently the default template is None, in which case get_file behaves as it did. If the rendering engines supported templating on a in-memory string instead of a (temp) file I'd be more inclined to make the default template jinja.

Updated docs, and added an integration test.

Thanks,
Ryan