mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 03:45:01 -02:30
Expand dbconfig support
* Support updating settings values * Support activity stream endpoint * Support clearing value * Improve type conversion system for displaying values
This commit is contained in:
@@ -20,6 +20,7 @@ class TowerSettings(CreatedModifiedModel):
|
||||
('int', _('Integer')),
|
||||
('float', _('Decimal')),
|
||||
('json', _('JSON')),
|
||||
('bool', _('Boolean')),
|
||||
('password', _('Password')),
|
||||
('list', _('List'))
|
||||
]
|
||||
@@ -43,3 +44,15 @@ class TowerSettings(CreatedModifiedModel):
|
||||
editable=False,
|
||||
)
|
||||
|
||||
@property
|
||||
def value_converted(self):
|
||||
if self.value_type == 'json':
|
||||
converted_type = json.loads(self.value)
|
||||
elif self.value_type == 'password':
|
||||
converted_type = self.value
|
||||
elif self.value_type == 'list':
|
||||
converted_type = [x.strip() for x in self.value.split(',')]
|
||||
else:
|
||||
t = __builtins__[self.value_type]
|
||||
converted_type = t(self.value)
|
||||
return converted_type
|
||||
|
||||
Reference in New Issue
Block a user