mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
Fix to handle Str and JSON mix-in data correctly with settings API
- Fixed issue #5528 Signed-off-by: Hideki Saito <saito@fgrep.org>
This commit is contained in:
committed by
Ryan Petrello
parent
490492e505
commit
437d9843d1
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