fix issue

pull/410/head
vapao 2021-10-22 18:35:05 +08:00
parent 36f16592f6
commit fa271f4a5f
2 changed files with 2 additions and 5 deletions

View File

@ -204,7 +204,7 @@ def fetch_host_extend(ssh):
for ip in out.strip().split():
if ipaddress.ip_address(ip).is_global:
public_ip_address.add(ip)
else:
elif len(private_ip_address) < 10:
private_ip_address.add(ip)
ssh_hostname = ssh.arguments.get('hostname')

View File

@ -69,10 +69,7 @@ class HostView(View):
host = Host.objects.get(pk=form.id)
else:
host = Host.objects.create(created_by=request.user, is_verified=True, **form)
try:
_sync_host_extend(host, ssh=ssh)
except Exception:
pass
host.groups.set(group_ids)
response = host.to_view()
response['group_ids'] = group_ids