mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02:30
AC-505 Don't return regions/tags as list of strings for now.
This commit is contained in:
@@ -638,11 +638,11 @@ class InventorySourceSerializer(BaseSerializer):
|
|||||||
if field in ret and unicode(ret[field]).startswith('$encrypted$'):
|
if field in ret and unicode(ret[field]).startswith('$encrypted$'):
|
||||||
ret[field] = '$encrypted$'
|
ret[field] = '$encrypted$'
|
||||||
# Make regions/tags into a list of strings.
|
# Make regions/tags into a list of strings.
|
||||||
for field in ('source_regions', 'source_tags'):
|
#for field in ('source_regions', 'source_tags'):
|
||||||
if field in ret:
|
# if field in ret:
|
||||||
value = ret[field]
|
# value = ret[field]
|
||||||
if isinstance(value, basestring):
|
# if isinstance(value, basestring):
|
||||||
ret[field] = [x.strip() for x in value.split(',') if x.strip()]
|
# ret[field] = [x.strip() for x in value.split(',') if x.strip()]
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def restore_object(self, attrs, instance=None):
|
def restore_object(self, attrs, instance=None):
|
||||||
@@ -650,7 +650,10 @@ class InventorySourceSerializer(BaseSerializer):
|
|||||||
for field in InventorySource.PASSWORD_FIELDS:
|
for field in InventorySource.PASSWORD_FIELDS:
|
||||||
if unicode(attrs.get(field, '')).startswith('$encrypted$'):
|
if unicode(attrs.get(field, '')).startswith('$encrypted$'):
|
||||||
attrs.pop(field, None)
|
attrs.pop(field, None)
|
||||||
# FIXME: Accept list of strings for regions/tags.
|
#for field in ('source_regions', 'source_tags'):
|
||||||
|
# value = attrs.get(field, [])
|
||||||
|
# if isinstance(value, (list,tuple)):
|
||||||
|
# attrs[field] = ','.join([unicode(x).strip() for x in value])
|
||||||
instance = super(InventorySourceSerializer, self).restore_object(attrs, instance)
|
instance = super(InventorySourceSerializer, self).restore_object(attrs, instance)
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user