mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add get_template to cp module
This commit is contained in:
parent
62b2166ab4
commit
8866e756fb
@ -52,6 +52,26 @@ def get_file(path, dest, env='base'):
|
||||
return client.get_file(path, dest, False, env)
|
||||
|
||||
|
||||
def get_template(path, dest, template='jinja', env='base', **kwargs):
|
||||
'''
|
||||
Render a file as a template before settign it down
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt '*' cp.get_template salt://path/to/template /minion/dest
|
||||
'''
|
||||
client = salt.fileclient.get_file_client(__opts__)
|
||||
if not 'salt' in kwargs:
|
||||
kwargs['salt'] = __salt__
|
||||
if not 'pillar' in kwargs:
|
||||
kwargs['pillar'] = __pillar__
|
||||
if not 'grains' in kwargs:
|
||||
kwargs['grains'] = __grains__
|
||||
if not 'opts' in kwargs:
|
||||
kwargs['opts'] = __opts__
|
||||
return client.get_template(path, dest, template, False, env, **kwargs)
|
||||
|
||||
|
||||
def get_dir(path, dest, env='base'):
|
||||
'''
|
||||
Used to recursively copy a directory from the salt master
|
||||
|
Loading…
Reference in New Issue
Block a user