From 1bb1a6b878ec9547193c3b44418177449990dec3 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Fri, 18 Jan 2008 22:24:53 +0000 Subject: [PATCH] method for issuing commands on remote nodes (i.e. restarting node manager) --- qaapi/qa/modules/plc/remote_call.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 qaapi/qa/modules/plc/remote_call.py diff --git a/qaapi/qa/modules/plc/remote_call.py b/qaapi/qa/modules/plc/remote_call.py new file mode 100644 index 0000000..e947b98 --- /dev/null +++ b/qaapi/qa/modules/plc/remote_call.py @@ -0,0 +1,23 @@ +import os +from qa.Test import Test +from qa import utils + +class remote_call(Test): + """ + Attempt to connect to a node using the plc root key and + issue a command. + """ + + def call(self, root_key_path, hostname, command): + if not os.path.isfile(root_key_path): + raise Exception, "no such private key file %(root_key_path)s" % locals() + + full_command = "ssh -i %(root_key_path)s root@%(hostname) %(command)s" % locals() + if self.config.verbose: + utils.header(full_command) + (stdout, stderr) = utils.popen(full_command) + if self.config.verbose: + utils.header("\n".join(stdout)) + + + return 1 -- 2.47.0