allow passing arguments to Popen()
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
0dc6af2512
commit
e8360df96b
1 changed files with 4 additions and 4 deletions
|
@ -59,22 +59,22 @@ class Cdist:
|
|||
sys.exit(1)
|
||||
|
||||
|
||||
def run_or_fail(self,*args):
|
||||
def run_or_fail(self,*args, **kargs):
|
||||
# newargs = ["echo"]
|
||||
newargs = []
|
||||
newargs.extend(*args)
|
||||
print(newargs)
|
||||
|
||||
try:
|
||||
subprocess.check_call(newargs)
|
||||
subprocess.check_call(newargs, **kargs)
|
||||
except subprocess.CalledProcessError:
|
||||
self.exit_error("Command failed:", " ".join(newargs))
|
||||
|
||||
def remote_run_or_fail(self, *args):
|
||||
def remote_run_or_fail(self, *args, **kargs):
|
||||
"""Run something on the remote side and fail is something breaks"""
|
||||
newargs = ["ssh", "root@" + self.hostname]
|
||||
newargs.extend(*args)
|
||||
self.run_or_fail(newargs)
|
||||
self.run_or_fail(newargs, **kargs)
|
||||
|
||||
def remove_remote_dir(self, destination):
|
||||
self.remote_run_or_fail(["rm", "-rf", destination])
|
||||
|
|
Loading…
Reference in a new issue