From d23cc82b2637aff1d30d74269a3e7ef4028847ae Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: May 04 2017 07:09:43 +0000 Subject: [backend] drop root_conn from builder This is not needed for quite some time already. --- diff --git a/backend/backend/exceptions.py b/backend/backend/exceptions.py index c27969e..551a7fe 100644 --- a/backend/backend/exceptions.py +++ b/backend/backend/exceptions.py @@ -5,9 +5,9 @@ class BuilderError(MockRemoteError): pass class RemoteCmdError(BuilderError): - def __init__(self, msg, cmd, as_root, rc, stderr, stdout): - self.msg = "{}\nCMD:{}\nRC:{}\nAS_ROOT:{}\nSTDERR:{}\nSTDOUT:{}".format( - msg, cmd, as_root, rc, stderr, stdout + def __init__(self, msg, cmd, rc, stderr, stdout): + self.msg = "{}\nCMD:{}\nRC:{}\nSTDERR:{}\nSTDOUT:{}".format( + msg, cmd, rc, stderr, stdout ) super(RemoteCmdError, self).__init__(self.msg) diff --git a/backend/backend/mockremote/builder.py b/backend/backend/mockremote/builder.py index b7dc20d..9596723 100644 --- a/backend/backend/mockremote/builder.py +++ b/backend/backend/mockremote/builder.py @@ -33,8 +33,11 @@ class Builder(object): self.resultdir = os.path.join(self.builddir, 'results') self.pidfile = os.path.join(self.builddir, 'pid') - self.root_conn = SSHConnection(host=self.hostname, config_file=self.opts.ssh.builder_config) - self.conn = SSHConnection(user=self.opts.build_user, host=self.hostname, config_file=self.opts.ssh.builder_config) + self.conn = SSHConnection( + user=self.opts.build_user, + host=self.hostname, + config_file=self.opts.ssh.builder_config + ) self.module_dist_tag = self._load_module_dist_tag() self._build_pid = None @@ -54,25 +57,18 @@ class Builder(object): self.log.info("Loaded {}, dist_tag {}".format(module_md_filepath, dist_tag)) return dist_tag - def _run_ssh_cmd(self, cmd, as_root=False): + def _run_ssh_cmd(self, cmd): """ Executes single shell command remotely :param str cmd: shell command - :param bool as_root: :return: stdout, stderr as strings """ - if as_root: - conn = self.root_conn - else: - conn = self.conn - self.log.info("BUILDER CMD: "+cmd) - - rc, out, err = conn.run_expensive(cmd) + rc, out, err = self.conn.run_expensive(cmd) if rc != 0: raise RemoteCmdError("Error running remote ssh command.", - cmd, rc, as_root, err, out) + cmd, rc, err, out) return out, err def collect_built_packages(self):