From 2efd68237b1c72ab0caf13047f3e8b35f6bd13c8 Mon Sep 17 00:00:00 2001 From: vapao Date: Sun, 19 Dec 2021 19:52:38 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E5=88=97=E8=A1=A8ip=E5=B1=95=E7=A4=BA=E7=9A=84=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/host/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spug_api/apps/host/utils.py b/spug_api/apps/host/utils.py index c0a13d7..0b48f3b 100644 --- a/spug_api/apps/host/utils.py +++ b/spug_api/apps/host/utils.py @@ -210,9 +210,13 @@ def fetch_host_extend(ssh): ssh_hostname = ssh.arguments.get('hostname') if ip_validator(ssh_hostname): if ipaddress.ip_address(ssh_hostname).is_global: - public_ip_address.add(ssh_hostname) + if ssh_hostname in public_ip_address: + public_ip_address.remove(ssh_hostname) + public_ip_address = [ssh_hostname] + list(public_ip_address) else: - private_ip_address.add(ssh_hostname) + if ssh_hostname in private_ip_address: + private_ip_address.remove(ssh_hostname) + private_ip_address = [ssh_hostname] + list(private_ip_address) code, out = ssh.exec_command_raw('lsblk -dbn -o SIZE -e 11 2> /dev/null') if code == 0: