diff --git a/Makefile b/Makefile index 5f54354bb4..caca0ec67a 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,7 @@ clean-api: rm -rf awx/projects clean-awxkit: - rm -rf awxkit/*.egg-info awxkit/.tox + rm -rf awxkit/*.egg-info awxkit/.tox awxkit/build/* # convenience target to assert environment variables are defined guard-%: diff --git a/awxkit/awxkit/cli/custom.py b/awxkit/awxkit/cli/custom.py index 807bd005b7..0d46e40b88 100644 --- a/awxkit/awxkit/cli/custom.py +++ b/awxkit/awxkit/cli/custom.py @@ -1,4 +1,5 @@ import functools +import json from six import with_metaclass @@ -539,5 +540,15 @@ class SettingsModify(CustomAction): def perform(self, key, value): self.page.endpoint = self.page.endpoint + 'all/' - resp = self.page.patch(**{key: value}) + patch_value = value + if self.is_json(value): + patch_value = json.loads(value) + resp = self.page.patch(**{key: patch_value}) return resp.from_json({'key': key, 'value': resp[key]}) + + def is_json(self, data): + try: + json.loads(data) + except json.decoder.JSONDecodeError: + return False + return True