From fd694d13fa094528e00f432099541c63baa6df78 Mon Sep 17 00:00:00 2001 From: lukemartinlogan Date: Tue, 11 Feb 2025 15:24:22 -0600 Subject: [PATCH 1/5] Add hostfile print to jarvis util --- jarvis_util/introspect/system_info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jarvis_util/introspect/system_info.py b/jarvis_util/introspect/system_info.py index 12f05bf..ad20e2a 100644 --- a/jarvis_util/introspect/system_info.py +++ b/jarvis_util/introspect/system_info.py @@ -362,6 +362,7 @@ class ChiNetPing(Exec): Determine whether a network functions across a set of hosts """ def __init__(self, provider, domain, port, mode, exec_info): + print(f'Hostfile being used: ', exec_info.hostfile.path if exec_info.hostfile.path else '\"\"',) self.cmd = [ 'chi_net_ping', exec_info.hostfile.path if exec_info.hostfile.path else '\"\"', From 949e4b651d1a67b10e3b0d2bb65715f3668f6b46 Mon Sep 17 00:00:00 2001 From: lukemartinlogan Date: Tue, 11 Feb 2025 15:46:41 -0600 Subject: [PATCH 2/5] Add one more print --- jarvis_util/introspect/system_info.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jarvis_util/introspect/system_info.py b/jarvis_util/introspect/system_info.py index ad20e2a..33f672f 100644 --- a/jarvis_util/introspect/system_info.py +++ b/jarvis_util/introspect/system_info.py @@ -362,7 +362,8 @@ class ChiNetPing(Exec): Determine whether a network functions across a set of hosts """ def __init__(self, provider, domain, port, mode, exec_info): - print(f'Hostfile being used: ', exec_info.hostfile.path if exec_info.hostfile.path else '\"\"',) + hostfile = exec_info.hostfile.path if exec_info.hostfile.path else '\"\"' + print(f'Hostfile for {port} and {mode} (2): {hostfile}') self.cmd = [ 'chi_net_ping', exec_info.hostfile.path if exec_info.hostfile.path else '\"\"', @@ -383,6 +384,7 @@ class ChiNetPingTest: Determine whether a network functions across a set of hosts """ def __init__(self, provider, domain, port, exec_info, net_sleep=10): + print(f'Hostfile for {port} (1): {exec_info.hostfile.path}') self.server = ChiNetPing(provider, domain, port, "server", exec_info.mod(exec_async=True)) time.sleep(net_sleep) self.client = ChiNetPing(provider, domain, port, "client", exec_info) From adf77726d4544ba990b3ce02a906d16087c62c1c Mon Sep 17 00:00:00 2001 From: lukemartinlogan Date: Wed, 12 Feb 2025 03:44:51 -0600 Subject: [PATCH 3/5] Add chi-net-ping updates --- jarvis_util/introspect/system_info.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/jarvis_util/introspect/system_info.py b/jarvis_util/introspect/system_info.py index 33f672f..fdb4e34 100644 --- a/jarvis_util/introspect/system_info.py +++ b/jarvis_util/introspect/system_info.py @@ -361,16 +361,16 @@ class ChiNetPing(Exec): """ Determine whether a network functions across a set of hosts """ - def __init__(self, provider, domain, port, mode, exec_info): + def __init__(self, provider, domain, port, mode, local_only, exec_info): hostfile = exec_info.hostfile.path if exec_info.hostfile.path else '\"\"' - print(f'Hostfile for {port} and {mode} (2): {hostfile}') self.cmd = [ 'chi_net_ping', - exec_info.hostfile.path if exec_info.hostfile.path else '\"\"', + hostfile, provider, domain, str(port), - mode + mode, + local_only ] self.cmd = ' '.join(self.cmd) if mode == 'server': @@ -383,11 +383,10 @@ class ChiNetPingTest: """ Determine whether a network functions across a set of hosts """ - def __init__(self, provider, domain, port, exec_info, net_sleep=10): - print(f'Hostfile for {port} (1): {exec_info.hostfile.path}') - self.server = ChiNetPing(provider, domain, port, "server", exec_info.mod(exec_async=True)) + def __init__(self, provider, domain, port, local_only, exec_info, net_sleep=10): + self.server = ChiNetPing(provider, domain, port, "server", local_only, exec_info.mod(exec_async=True)) time.sleep(net_sleep) - self.client = ChiNetPing(provider, domain, port, "client", exec_info) + self.client = ChiNetPing(provider, domain, port, "client", local_only, exec_info) self.exit_code = self.client.exit_code # Kill('chi_net_ping', exec_info) @@ -430,14 +429,14 @@ def _async_test(self, idx, net, port, exec_info, net_sleep): domain = net['domain'] fabric = net['fabric'] # Test if the network works locally - ping = ChiNetPingTest(provider, domain, port, exec_info.mod(hostfile=None), 2) + ping = ChiNetPingTest(provider, domain, port, "local", exec_info, 2) net['shared'] = False if ping.exit_code != 0: print(f'Testing the network {provider}://{domain}/[{fabric}]:{port}: FAILED {ping.exit_code}') return self.results[idx] = net # Test if the network works across hosts - ping = ChiNetPingTest(provider, domain, port, exec_info, net_sleep) + ping = ChiNetPingTest(provider, domain, port, "all", exec_info, net_sleep) if ping.exit_code == 0: net['shared'] = True print(f'Testing the network {provider}://{domain}/[{fabric}]:{port}: SUCCESS') From d33ec335e65ba0f3aacd4b8021c1be62d48b9382 Mon Sep 17 00:00:00 2001 From: lukemartinlogan Date: Wed, 12 Feb 2025 03:46:16 -0600 Subject: [PATCH 4/5] Make hostfile paths absolute --- jarvis_util/util/hostfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jarvis_util/util/hostfile.py b/jarvis_util/util/hostfile.py index a91b6c2..c8da113 100644 --- a/jarvis_util/util/hostfile.py +++ b/jarvis_util/util/hostfile.py @@ -43,6 +43,7 @@ def __init__(self, hostfile=None, all_hosts=None, all_hosts_ip=None, # From hostfile path elif hostfile is not None: + self.path = os.path.abspath(hostfile) self._load_hostfile(self.path) # From hostfile text From 0d692e480656c9388e1972e67cdbbaacaab9f7dc Mon Sep 17 00:00:00 2001 From: lukemartinlogan Date: Wed, 12 Feb 2025 03:49:02 -0600 Subject: [PATCH 5/5] filter out #s --- jarvis_util/util/hostfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jarvis_util/util/hostfile.py b/jarvis_util/util/hostfile.py index c8da113..cce0b30 100644 --- a/jarvis_util/util/hostfile.py +++ b/jarvis_util/util/hostfile.py @@ -81,6 +81,9 @@ def parse(self, text): lines = text.strip().splitlines() hosts = [] for line in lines: + line = line.strip() + if len(line) == 0 or line[0] == '#': + continue self._expand_line(hosts, line) self._set_hosts(hosts)