mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Merge pull request #5784 from ryanpetrello/issue/5528
Fix to handle Str and JSON mix-in data correctly with settings API Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
2
Makefile
2
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-%:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user