Skip to content

Commit

Permalink
Update ip address comparison in smt reg test
Browse files Browse the repository at this point in the history
use builtin ipaddress object to compare ip addresses. This allows
for the different formats of ipv6 addresses to be handled properly.
  • Loading branch information
smarlowucf committed Oct 21, 2024
1 parent eba43c6 commit c6d8891
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion usr/share/lib/img_proof/tests/SLES/test_sles_smt_reg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ipaddress
import pytest
import shlex


Expand All @@ -23,7 +25,11 @@ def test_sles_smt_reg(
)
smt_ip = shlex.split(result.stdout)[0]

assert smt_ip in smt_ips
for server_ip in smt_ips:
if ipaddress.ip_address(smt_ip) == ipaddress.ip_address(server_ip):
break
else:
pytest.fail(f'RMT Server not found {smt_ip}')

# ensure region hint is in log
cloud_register_log = host.file('/var/log/cloudregister')
Expand Down

0 comments on commit c6d8891

Please sign in to comment.