From 3adc1f569d77f8032a1fa3f8a7ee519616e0ac15 Mon Sep 17 00:00:00 2001 From: adobdin Date: Fri, 19 Feb 2016 13:17:52 +0000 Subject: [PATCH] added: fake execution of commands --- nodes.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/nodes.py b/nodes.py index 127e5ef..5cffdd8 100644 --- a/nodes.py +++ b/nodes.py @@ -103,7 +103,7 @@ class Node(object): logging.debug('add files:\nnode: %s, key: %s, files:\n%s' % (self.node_id, key, self.files[key])) - def exec_cmd(self, label, sshvars, sshopts, odir='info', timeout=15): + def exec_cmd(self, label, sshvars, sshopts, odir='info', timeout=15, fake=false): sn = 'node-%s' % self.node_id cl = 'cluster-%s' % self.cluster logging.debug('%s/%s/%s/%s' % (odir, label, cl, sn)) @@ -111,13 +111,14 @@ class Node(object): mdir(ddir) for f in self.files[label]: logging.info('node:%s(%s), exec: %s' % (self.node_id, self.ip, f)) - outs, errs, code = ssh_node(ip=self.ip, - filename=f, - sshvars=sshvars, - sshopts=sshopts, - timeout=timeout, - command='' - ) + if not fake: + outs, errs, code = ssh_node(ip=self.ip, + filename=f, + sshvars=sshvars, + sshopts=sshopts, + timeout=timeout, + command='' + ) if code != 0: logging.error("node: %s, ip: %s, cmdfile: %s," " code: %s, error message: %s" %