diff --git a/spug_api/apps/host/utils.py b/spug_api/apps/host/utils.py index ad08440..44542c7 100644 --- a/spug_api/apps/host/utils.py +++ b/spug_api/apps/host/utils.py @@ -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') diff --git a/spug_api/apps/host/views.py b/spug_api/apps/host/views.py index d7f27b4..a7ab4f4 100644 --- a/spug_api/apps/host/views.py +++ b/spug_api/apps/host/views.py @@ -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 + _sync_host_extend(host, ssh=ssh) host.groups.set(group_ids) response = host.to_view() response['group_ids'] = group_ids