core: add "localcmd" support in QubesVm.run_service function

This commit is contained in:
Marek Marczykowski-Górecki 2015-07-08 01:23:47 +02:00
parent 50a9c62d0e
commit 284419b355

View File

@ -1552,11 +1552,14 @@ class QubesVm(object):
return retcode
def run_service(self, service, source="dom0", user=None,
passio_popen = False, input=None):
if input and passio_popen:
raise ValueError("'input' and 'passio_popen' cannot be used "
"together")
if input:
passio_popen=False, input=None, localcmd=None):
if bool(input) + bool(passio_popen) + bool(localcmd) > 1:
raise ValueError("'input', 'passio_popen', 'localcmd' cannot be "
"used together")
if localcmd:
return self.run("QUBESRPC %s %s" % (service, source),
localcmd=localcmd, user=user, wait=True)
elif input:
return self.run("QUBESRPC %s %s" % (service, source),
localcmd="echo %s" % input, user=user, wait=True)
else: