From 8ba2b1b50ca6f53d5735a3c561fb3bd47998c053 Mon Sep 17 00:00:00 2001 From: Gabe Muniz Date: Mon, 20 Feb 2023 10:20:23 -0500 Subject: [PATCH] [constructed-inventory]Fix validation issue constructed --- awx/api/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 060ce1cb91..3639efdf2b 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -2272,7 +2272,7 @@ class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOpt if get_field_from_model_or_attrs('source') == 'scm': if ('source' in attrs or 'source_project' in attrs) and get_field_from_model_or_attrs('source_project') is None: raise serializers.ValidationError({"source_project": _("Project required for scm type sources.")}) - elif get_field_from_model_or_attrs('source') == 'constructed': + elif (get_field_from_model_or_attrs('source') == 'constructed') and (self.instance and self.instance.source != 'constructed'): raise serializers.ValidationError({"Error": _('constructed not a valid source for inventory')}) else: redundant_scm_fields = list(filter(lambda x: attrs.get(x, None), ['source_project', 'source_path']))