U 优化主机列表ip展示的优先级

pull/442/head
vapao 2021-12-19 19:52:38 +08:00
parent b0dbfb9324
commit 2efd68237b
1 changed files with 6 additions and 2 deletions

View File

@ -210,9 +210,13 @@ def fetch_host_extend(ssh):
ssh_hostname = ssh.arguments.get('hostname') ssh_hostname = ssh.arguments.get('hostname')
if ip_validator(ssh_hostname): if ip_validator(ssh_hostname):
if ipaddress.ip_address(ssh_hostname).is_global: 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: 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') code, out = ssh.exec_command_raw('lsblk -dbn -o SIZE -e 11 2> /dev/null')
if code == 0: if code == 0: