mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
misc cleanup in the runner module, splitting some things out into utils, breaking up functions into smaller functions.
This commit is contained in:
parent
fef73393f0
commit
6a7aac38c5
3 changed files with 259 additions and 337 deletions
|
@ -272,6 +272,9 @@ def template(text, vars):
|
|||
template = jinja2.Template(text)
|
||||
return template.render(vars)
|
||||
|
||||
def double_template(text, vars):
|
||||
return template(template(text, vars), vars)
|
||||
|
||||
def template_from_file(path, vars):
|
||||
''' run a file through the templating engine '''
|
||||
data = file(path).read()
|
||||
|
@ -287,4 +290,12 @@ def parse_yaml_from_file(path):
|
|||
raise errors.AnsibleError("file not found: %s" % path)
|
||||
return parse_yaml(data)
|
||||
|
||||
def parse_kv(args):
|
||||
''' convert a string of key/value items to a dict '''
|
||||
options = {}
|
||||
for x in args:
|
||||
if x.find("=") != -1:
|
||||
k, v = x.split("=")
|
||||
options[k]=v
|
||||
return options
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue