diff --git a/CHANGES.md b/CHANGES.md index 117f14a..2cfc384 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. diff --git a/actions/lib/ansible_base.py b/actions/lib/ansible_base.py index 9b33539..4fee018 100755 --- a/actions/lib/ansible_base.py +++ b/actions/lib/ansible_base.py @@ -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: diff --git a/pack.yaml b/pack.yaml index adb6920..e6bd347 100644 --- a/pack.yaml +++ b/pack.yaml @@ -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 diff --git a/tests/test_actions_lib_ansiblebaserunner.py b/tests/test_actions_lib_ansiblebaserunner.py index 924fc16..1839c7e 100644 --- a/tests/test_actions_lib_ansiblebaserunner.py +++ b/tests/test_actions_lib_ansiblebaserunner.py @@ -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): @@ -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)