mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
prevent server error in POST to group hosts
This commit is contained in:
parent
ed3e03644b
commit
0a339ed05c
@ -2218,7 +2218,7 @@ class GroupHostsList(ControlledByScmMixin, SubListCreateAttachDetachAPIView):
|
||||
parent_group = Group.objects.get(id=self.kwargs['pk'])
|
||||
# Inject parent group inventory ID into new host data.
|
||||
request.data['inventory'] = parent_group.inventory_id
|
||||
existing_hosts = Host.objects.filter(inventory=parent_group.inventory, name=request.data['name'])
|
||||
existing_hosts = Host.objects.filter(inventory=parent_group.inventory, name=request.data.get('name', ''))
|
||||
if existing_hosts.count() > 0 and ('variables' not in request.data or
|
||||
request.data['variables'] == '' or
|
||||
request.data['variables'] == '{}' or
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user