mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
Merge pull request #7027 from AlanCoding/more_trans_str
Mark view error codes for translation
This commit is contained in:
@@ -2507,7 +2507,7 @@ class InventoryInventorySourcesUpdate(RetrieveAPIView):
|
|||||||
|
|
||||||
if inventory_source.source == 'scm' and inventory_source.update_on_project_update:
|
if inventory_source.source == 'scm' and inventory_source.update_on_project_update:
|
||||||
if not request.user or not request.user.can_access(Project, 'start', inventory_source.source_project):
|
if not request.user or not request.user.can_access(Project, 'start', inventory_source.source_project):
|
||||||
details['status'] = 'You do not have permission to update project `{}`'.format(inventory_source.source_project.name)
|
details['status'] = _('You do not have permission to update project `{}`').format(inventory_source.source_project.name)
|
||||||
can_update = False
|
can_update = False
|
||||||
else:
|
else:
|
||||||
project_update = True
|
project_update = True
|
||||||
@@ -2520,7 +2520,7 @@ class InventoryInventorySourcesUpdate(RetrieveAPIView):
|
|||||||
successes += 1
|
successes += 1
|
||||||
else:
|
else:
|
||||||
if not details.get('status'):
|
if not details.get('status'):
|
||||||
details['status'] = 'Could not start because `can_update` returned False'
|
details['status'] = _('Could not start because `can_update` returned False')
|
||||||
failures += 1
|
failures += 1
|
||||||
update_data.append(details)
|
update_data.append(details)
|
||||||
if failures and successes:
|
if failures and successes:
|
||||||
@@ -2528,7 +2528,7 @@ class InventoryInventorySourcesUpdate(RetrieveAPIView):
|
|||||||
elif failures and not successes:
|
elif failures and not successes:
|
||||||
status_code = status.HTTP_400_BAD_REQUEST
|
status_code = status.HTTP_400_BAD_REQUEST
|
||||||
elif not failures and not successes:
|
elif not failures and not successes:
|
||||||
return Response({'detail': 'No inventory sources to update.'},
|
return Response({'detail': _('No inventory sources to update.')},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
else:
|
else:
|
||||||
status_code = status.HTTP_200_OK
|
status_code = status.HTTP_200_OK
|
||||||
@@ -3274,7 +3274,7 @@ class WorkflowJobTemplateNodeChildrenBaseList(WorkflowsEnforcementMixin, Enforce
|
|||||||
mutex_list = ('success_nodes', 'failure_nodes') if self.relationship == 'always_nodes' else ('always_nodes',)
|
mutex_list = ('success_nodes', 'failure_nodes') if self.relationship == 'always_nodes' else ('always_nodes',)
|
||||||
for relation in mutex_list:
|
for relation in mutex_list:
|
||||||
if getattr(parent, relation).all().exists():
|
if getattr(parent, relation).all().exists():
|
||||||
return {'Error': 'Cannot associate {0} when {1} have been associated.'.format(self.relationship, relation)}
|
return {'Error': _('Cannot associate {0} when {1} have been associated.').format(self.relationship, relation)}
|
||||||
|
|
||||||
if created:
|
if created:
|
||||||
return None
|
return None
|
||||||
@@ -3299,12 +3299,12 @@ class WorkflowJobTemplateNodeChildrenBaseList(WorkflowsEnforcementMixin, Enforce
|
|||||||
sub_node = graph[sub.pk]
|
sub_node = graph[sub.pk]
|
||||||
parent_node = graph[parent.pk]
|
parent_node = graph[parent.pk]
|
||||||
if sub_node['metadata']['parent'] is not None:
|
if sub_node['metadata']['parent'] is not None:
|
||||||
return {"Error": "Multiple parent relationship not allowed."}
|
return {"Error": _("Multiple parent relationship not allowed.")}
|
||||||
sub_node['metadata']['parent'] = parent_node
|
sub_node['metadata']['parent'] = parent_node
|
||||||
iter_node = sub_node
|
iter_node = sub_node
|
||||||
while iter_node is not None:
|
while iter_node is not None:
|
||||||
if iter_node['metadata']['traversed']:
|
if iter_node['metadata']['traversed']:
|
||||||
return {"Error": "Cycle detected."}
|
return {"Error": _("Cycle detected.")}
|
||||||
iter_node['metadata']['traversed'] = True
|
iter_node['metadata']['traversed'] = True
|
||||||
iter_node = iter_node['metadata']['parent']
|
iter_node = iter_node['metadata']['parent']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user