diff --git a/awx/api/views.py b/awx/api/views.py index 98a04c4626..5ec19e2f8c 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -2482,9 +2482,12 @@ class InventoryInventorySourcesUpdate(RetrieveAPIView): inventory = self.get_object() update_data = [] for inventory_source in inventory.inventory_sources.all(): - details = {'inventory_source': inventory_source.pk, - 'can_update': inventory_source.can_update} - update_data.append(details) + if inventory_source.source == '': + continue + else: + details = {'inventory_source': inventory_source.pk, + 'can_update': inventory_source.can_update} + update_data.append(details) return Response(update_data) def post(self, request, *args, **kwargs): @@ -2503,7 +2506,8 @@ class InventoryInventorySourcesUpdate(RetrieveAPIView): can_update = False else: project_update = True - + if inventory_source.source == '': + continue if can_update: if project_update: details['project_update'] = inventory_source.source_project.update().id @@ -2885,7 +2889,7 @@ class JobTemplateSurveySpec(GenericAPIView): if survey_item["type"] == "password": if survey_item.get("default") and survey_item["default"].startswith('$encrypted$'): if not obj.survey_spec: - return Response(dict(error=_("$encrypted$ is reserved keyword and may not be used as a default for password {}.".format(str(idx)))), + return Response(dict(error=_("$encrypted$ is reserved keyword and may not be used as a default for password {}.".format(str(idx)))), status=status.HTTP_400_BAD_REQUEST) else: old_spec = obj.survey_spec