mirror of https://github.com/openspug/spug
fix issue
parent
36f16592f6
commit
fa271f4a5f
|
@ -204,7 +204,7 @@ def fetch_host_extend(ssh):
|
||||||
for ip in out.strip().split():
|
for ip in out.strip().split():
|
||||||
if ipaddress.ip_address(ip).is_global:
|
if ipaddress.ip_address(ip).is_global:
|
||||||
public_ip_address.add(ip)
|
public_ip_address.add(ip)
|
||||||
else:
|
elif len(private_ip_address) < 10:
|
||||||
private_ip_address.add(ip)
|
private_ip_address.add(ip)
|
||||||
|
|
||||||
ssh_hostname = ssh.arguments.get('hostname')
|
ssh_hostname = ssh.arguments.get('hostname')
|
||||||
|
|
|
@ -69,10 +69,7 @@ class HostView(View):
|
||||||
host = Host.objects.get(pk=form.id)
|
host = Host.objects.get(pk=form.id)
|
||||||
else:
|
else:
|
||||||
host = Host.objects.create(created_by=request.user, is_verified=True, **form)
|
host = Host.objects.create(created_by=request.user, is_verified=True, **form)
|
||||||
try:
|
_sync_host_extend(host, ssh=ssh)
|
||||||
_sync_host_extend(host, ssh=ssh)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
host.groups.set(group_ids)
|
host.groups.set(group_ids)
|
||||||
response = host.to_view()
|
response = host.to_view()
|
||||||
response['group_ids'] = group_ids
|
response['group_ids'] = group_ids
|
||||||
|
|
Loading…
Reference in New Issue