mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 08:57:35 -02:30
A few super minor nits in api views/serializers (#12996)
Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
@@ -615,7 +615,7 @@ class BaseSerializer(serializers.ModelSerializer, metaclass=BaseSerializerMetacl
|
|||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
attrs = super(BaseSerializer, self).validate(attrs)
|
attrs = super(BaseSerializer, self).validate(attrs)
|
||||||
try:
|
try:
|
||||||
# Create/update a model instance and run it's full_clean() method to
|
# Create/update a model instance and run its full_clean() method to
|
||||||
# do any validation implemented on the model class.
|
# do any validation implemented on the model class.
|
||||||
exclusions = self.get_validation_exclusions(self.instance)
|
exclusions = self.get_validation_exclusions(self.instance)
|
||||||
obj = self.instance or self.Meta.model()
|
obj = self.instance or self.Meta.model()
|
||||||
@@ -3229,7 +3229,7 @@ class JobCreateScheduleSerializer(LabelsListMixin, BaseSerializer):
|
|||||||
ret['labels'] = self._summary_field_labels(config)
|
ret['labels'] = self._summary_field_labels(config)
|
||||||
return ret
|
return ret
|
||||||
except JobLaunchConfig.DoesNotExist:
|
except JobLaunchConfig.DoesNotExist:
|
||||||
return {'all': _('Unknown, job may have been ran before launch configurations were saved.')}
|
return {'all': _('Unknown, job may have been run before launch configurations were saved.')}
|
||||||
|
|
||||||
|
|
||||||
class AdHocCommandSerializer(UnifiedJobSerializer):
|
class AdHocCommandSerializer(UnifiedJobSerializer):
|
||||||
|
|||||||
@@ -2406,9 +2406,8 @@ class JobTemplateLaunch(RetrieveAPIView):
|
|||||||
"""
|
"""
|
||||||
modern_data = data.copy()
|
modern_data = data.copy()
|
||||||
|
|
||||||
id_fd = '{}_id'.format('inventory')
|
if 'inventory' not in modern_data and 'inventory_id' in modern_data:
|
||||||
if 'inventory' not in modern_data and id_fd in modern_data:
|
modern_data['inventory'] = modern_data['inventory_id']
|
||||||
modern_data['inventory'] = modern_data[id_fd]
|
|
||||||
|
|
||||||
# credential passwords were historically provided as top-level attributes
|
# credential passwords were historically provided as top-level attributes
|
||||||
if 'credential_passwords' not in modern_data:
|
if 'credential_passwords' not in modern_data:
|
||||||
|
|||||||
Reference in New Issue
Block a user