Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v0.5.3

* Fixed a bug where JSON data was being passed incorrectly to `--extra-vars`. #19
Contributed by Nick Maludy (Encore Technologies)

## v0.5.2

* Added pywinrm to requirements so connection to windows hosts is possible.
Expand Down
2 changes: 1 addition & 1 deletion actions/lib/ansible_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _parse_extra_vars(self):

# Add --extra-vars for each json object
elif t == 'json':
self.args.append("--extra-vars='{0}'".format(json.dumps(v)))
self.args.append("--extra-vars={0}".format(json.dumps(v)))

# Combine contiguous kwarg vars into a single space-separated --extra-vars kwarg
elif t == 'kwarg' and last != t:
Expand Down
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ keywords:
- ansible
- cfg management
- configuration management
version : 0.5.2
version : 0.5.3
author : StackStorm, Inc.
email : info@stackstorm.com
4 changes: 2 additions & 2 deletions tests/test_actions_lib_ansiblebaserunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def extra_vars_json_yaml_fixture(self, test_name):
test_yaml = self.load_yaml('extra_vars_json.yaml')
test = next(t for t in test_yaml if t['name'] == test_name)
case = test['test']
expected = ['--extra-vars=\'{}\''.format(json.dumps(e)) for e in case]
expected = ['--extra-vars={}'.format(json.dumps(e)) for e in case]
self.check_arg_parse(arg, case, expected)

def test_parse_extra_vars_json_yaml_dict(self):
Expand Down Expand Up @@ -115,7 +115,7 @@ def extra_vars_complex_yaml_fixture(self, test_name):
# this does not preserve the order exactly, but it shows that elements are correctly parsed
expected = ['--extra-vars={}'.format(e)
for e in test['expected'] if isinstance(e, six.string_types)]
expected.extend(['--extra-vars=\'{}\''.format(json.dumps(e))
expected.extend(['--extra-vars={}'.format(json.dumps(e))
for e in test['expected'] if isinstance(e, dict)])
self.check_arg_parse(arg, case, expected)

Expand Down