self.search_curl_bin()
self.handler = BaseHandler(
- appname=self.appname, verbose=self.verbose, base_dir=self.base_dir)
+ appname=self.appname, verbose=self.verbose, base_dir=self.base_dir,
+ simulate=self.simulate)
return
elif self.verbose > 1:
r10k_loglevel = 'debug'
- cmd = []
- if self.do_sudo:
- cmd = ['sudo', '-n']
-
- cmd += [
+ cmd = [
self.r10k_bin, 'deploy', 'environment',
self.ref, '--puppetfile', '--verbose', r10k_loglevel
]
- cmd_str = ' '.join(map(lambda x: pipes.quote(x), cmd))
- if self.verbose > 2:
- LOG.debug("Cmd: {}".format(pp(cmd)))
- LOG.info("Executing: {}".format(cmd_str))
-
- if self.simulate:
- LOG.warn("Simulation mode, don't executing {!r}.".format(self.r10k_bin))
- time.sleep(3)
- return res
-
- LOG.debug("Really executing ...")
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- (stdoutdata, stderrdata) = proc.communicate()
- ret_val = proc.wait()
+ (ret_val, stdoutdata, stderrdata) = self.handler.call(cmd, sudo=self.do_sudo)
LOG.debug("Return value: {}".format(ret_val))
if stdoutdata: