diff options
Diffstat (limited to 'SharedModules/Utils/managerutils.py')
-rw-r--r-- | SharedModules/Utils/managerutils.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/SharedModules/Utils/managerutils.py b/SharedModules/Utils/managerutils.py deleted file mode 100644 index ca38b3f..0000000 --- a/SharedModules/Utils/managerutils.py +++ /dev/null @@ -1,55 +0,0 @@ -"""managerutils module. - -Supported Wrappers:- ---------------- -*) ssh_connect -*) ssh_connect_allhosts -""" - -import re -import ssh -from atfglobals import GlobalObj - -def ssh_connect(hostkey): - """ - """ - env = GlobalObj.getTestenvObj() - cm = GlobalObj.getConnectionsManagerObj() - host_connection = cm.getConnection(hostkey) - if not host_connection: - host_obj = env.getHost(hostkey) - if not host_obj: - print "Invalid Host. %s is not defined in TestEnvironment" % hostkey - return 1 - else: - host_connection = ssh.SshConnection() - if host_connection.connect(host_obj.hostname, host_obj.user, - host_obj.password): - return 1 - else: - if re.match("server", hostkey, re.IGNORECASE): - cm.addServer(hostkey, host_connection) - else: - cm.addClient(hostkey, host_connection) - return 0 - else: - print "Connection to %s already exist" % hostkey - - return 0 - -def ssh_connect_allhosts(): - """ - """ - env = GlobalObj.getTestenvObj() - cm = GlobalObj.getConnectionsManagerObj() - hosts_keys = env.getHostsKeys() - for hostkey in hosts_keys: - return_status = ssh_connect(hostkey) - if return_status: - return return_status - - return 0 - -__all__ = ['ssh_connect', - 'ssh_connect_allhosts'] - |