Skip to content

Commit

Permalink
Fixed crash bug triggered by missing inventory key
Browse files Browse the repository at this point in the history
  • Loading branch information
Tejeda, Engelbert committed Oct 10, 2019
1 parent f594e6b commit c7cb0d2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ansible_taskrunner/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
_doc = """
Ansible Taskrunner - ansible-playbook wrapper
- YAML-abstracted python click cli options
- Utilizes a specially-formatted ansible-playbook
- Utilizes a specially-formatted ansible-playbook (Taskfile.yaml)
to extend the ansible playbook command via
the python click module
"""

# Private variables
Expand Down Expand Up @@ -199,7 +201,7 @@
click_help = """\b
Ansible Taskrunner - ansible-playbook wrapper
- YAML-abstracted python click cli options
- Utilizes a specially-formatted ansible-playbook
- Utilizes a specially-formatted ansible-playbook (Taskfile.yaml)
to extend the ansible playbook command via
the python click module
"""
Expand Down Expand Up @@ -319,7 +321,7 @@ def init(**kwargs):

# Run command
# Parse help documentation
help_string = yamlr.deep_get(yaml_vars, 'help.message', '')
help_string = yamlr.deep_get(yaml_vars, 'help.message', 'Run the specified Taskfile')
help_string = Template(help_string).safe_substitute(**available_vars)
epilog_string = yamlr.deep_get(yaml_vars, 'help.epilog', '')
examples = yamlr.deep_get(yaml_vars, 'help.examples', '')
Expand Down Expand Up @@ -517,7 +519,7 @@ def run(args=None, **kwargs):
defaults_string_vars.append(
'__tasks_file__=%s' % tf_path
)
inventory_variable = 'inventory="""{v}"""'.format(v=yaml_vars['inventory'])
inventory_variable = 'inventory="""{v}"""'.format(v=yamlr.deep_get(yaml_vars, 'inventory', ''))
defaults_string_vars.append(inventory_variable)
# Short-circuit the task runner
# if we're calling functions from the commandline
Expand Down

0 comments on commit c7cb0d2

Please sign in to comment.