mirror of
https://github.com/saltstack/salt.git
synced 2025-04-10 14:51:40 +00:00
Fix status.master to detect master properly
This commit is contained in:
parent
671cdd9313
commit
e987ff4c01
3 changed files with 17 additions and 5 deletions
2
changelog/66716.fixed.md
Normal file
2
changelog/66716.fixed.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
Fixed an issue where ``status.master`` wasn't detecting a connection to the
|
||||
specified master properly
|
|
@ -497,8 +497,16 @@ def _get_connected_ips(port):
|
|||
|
||||
for conn in conns:
|
||||
if conn.status == psutil.CONN_ESTABLISHED:
|
||||
if conn.laddr.port == port:
|
||||
connected_ips.add(conn.laddr.ip)
|
||||
if conn.raddr.port == port:
|
||||
log.debug(
|
||||
"%s %s:%s --> %s:%s",
|
||||
conn.status,
|
||||
conn.laddr.ip,
|
||||
conn.laddr.port,
|
||||
conn.raddr.ip,
|
||||
conn.raddr.port,
|
||||
)
|
||||
connected_ips.add(conn.raddr.ip)
|
||||
|
||||
return connected_ips
|
||||
|
||||
|
|
|
@ -16,9 +16,11 @@ def test__get_connected_ips():
|
|||
conns = psutil.net_connections()
|
||||
for conn in conns:
|
||||
if conn.status == psutil.CONN_ESTABLISHED:
|
||||
ip = conn.laddr.ip
|
||||
port = conn.laddr.port
|
||||
ip = conn.raddr.ip
|
||||
port = conn.raddr.port
|
||||
break
|
||||
assert port is not None
|
||||
assert ip is not None
|
||||
assert win_status._get_connected_ips(port) == {ip}
|
||||
# Since this may return more than one IP, let's make sure our test IP is in
|
||||
# the list of IPs
|
||||
assert ip in win_status._get_connected_ips(port)
|
||||
|
|
Loading…
Add table
Reference in a new issue