From 33445fec6cf8701a43784067e501f577a6b3a6e4 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 25 Mar 2008 10:46:18 +0000 Subject: [PATCH] starts untangling; testssh should be built out of a hostname and possibly a key, *not* from a caller --- system/TestBox.py | 2 +- system/TestPlc.py | 2 +- system/TestSlice.py | 2 +- system/TestSliver.py | 2 +- system/TestSsh.py | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/system/TestBox.py b/system/TestBox.py index b2f6ab2..6c24959 100644 --- a/system/TestBox.py +++ b/system/TestBox.py @@ -17,7 +17,7 @@ class TestBox: return self.hostname_value def is_local(self): - return TestSsh.is_local (self.hostname()) + return self.test_ssh.is_local() def tar_logs(self): if os.path.isdir("nodeslogs"): diff --git a/system/TestPlc.py b/system/TestPlc.py index 4dbfa8a..335db14 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -59,7 +59,7 @@ class TestPlc: return self.plc_spec['hostname'] def is_local (self): - return TestSsh.is_local(self.hostname()) + return self.test_ssh.is_local() # define the API methods on this object through xmlrpc # would help, but not strictly necessary diff --git a/system/TestSlice.py b/system/TestSlice.py index 122c1ba..41757d4 100644 --- a/system/TestSlice.py +++ b/system/TestSlice.py @@ -20,7 +20,7 @@ class TestSlice: return self.slice_spec['slice_fields']['name'] def is_local(self): - return self.test_plc.is_local() + return self.test_ssh.is_local() def host_to_guest(self,command): return self.test_plc.host_to_guest(command) diff --git a/system/TestSliver.py b/system/TestSliver.py index 01b05ea..3aad927 100644 --- a/system/TestSliver.py +++ b/system/TestSliver.py @@ -13,7 +13,7 @@ class TestSliver: self.test_ssh =TestSsh(self) def is_local(self): - return self.test_plc.is_local() + return self.test_ssh.is_local() def host_to_guest(self,command): return self.test_plc.host_to_guest(command) diff --git a/system/TestSsh.py b/system/TestSsh.py index 761d5e6..17971d0 100644 --- a/system/TestSsh.py +++ b/system/TestSsh.py @@ -23,7 +23,7 @@ class TestSsh: # check main IP address against the provided hostname @staticmethod - def is_local (hostname): + def is_local_hostname (hostname): if hostname == "localhost": return True import socket @@ -32,7 +32,7 @@ class TestSsh: remote_ip = socket.gethostbyname(hostname) return local_ip==remote_ip except: - header("WARNING : something wrong in is_local with hostname=%s"%hostname) + header("WARNING : something wrong in is_local_hostname with hostname=%s"%hostname) return False def __init__(self,caller): @@ -41,13 +41,13 @@ class TestSsh: def hostname(self): return self.caller.hostname() def is_local(self): - return self.caller.is_local() + return TestSsh.is_local_hostname(self.hostname()) def buildname(self): return self.caller.buildname() # command gets run on the right box def to_host(self,command): - if self.caller.is_local(): + if self.is_local(): return command else: return "ssh %s %s"%(self.hostname(),TestSsh.backslash_shell_specials(command)) -- 2.43.0