Skip to content

Commit

Permalink
Added logic to automatically add triple-dashed options as bash vars i…
Browse files Browse the repository at this point in the history
…n subprocess
  • Loading branch information
Tejeda, Engelbert committed Aug 5, 2019
1 parent 24eb37b commit 2e06029
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion ansible_taskrunner/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ def run(args=None, **kwargs):
# Initialize values for subshell
prefix = 'echo' if kwargs.get('_echo') else ''
# Gather variables from commandline for interpolation
cli_vars = ''
provider_vars = ''
for key, value in kwargs.items():
if key.startswith('_'):
provider_vars += '{k}="{v}"\n'.format(k=key, v=value)
cli_vars = provider_vars
for key, value in kwargs.items():
if value and key not in internal_functions.keys():
if isinstance(value, list) or isinstance(value, tuple):
Expand Down
6 changes: 4 additions & 2 deletions ansible_taskrunner/lib/providers/vagrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ def __init__(self, parameter_set=None, vars_input={}):
@staticmethod
def options(func):
"""Add provider-specific click options"""
option = click.option('--is-vagrant',
is_flag=True, default=False, required=False)
option = click.option('---vagrant-test-flag',
is_flag=True, default=False,
help='Set the _vagrant_test_flag value to true',
required=False)
func = option(func)
return func

Expand Down

0 comments on commit 2e06029

Please sign in to comment.