mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Merge pull request #1080 from dagwieers/prompt-only_if
Add an only_if option to vars_prompt to make prompts conditional
This commit is contained in:
commit
734db4ffe9
3 changed files with 11 additions and 6 deletions
|
@ -317,12 +317,8 @@ class Runner(object):
|
|||
new_args = new_args + "%s='%s' " % (k,v)
|
||||
module_args = new_args
|
||||
|
||||
def _check_conditional(conditional):
|
||||
def is_set(var):
|
||||
return not var.startswith("$")
|
||||
return eval(conditional)
|
||||
conditional = utils.template(self.basedir, self.conditional, inject)
|
||||
if not _check_conditional(conditional):
|
||||
if not utils.check_conditional(conditional):
|
||||
result = utils.jsonify(dict(skipped=True))
|
||||
self.callbacks.on_skipped(host, inject.get('item',None))
|
||||
return ReturnData(host=host, result=result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue