core: add "localcmd" support in QubesVm.run_service function
This commit is contained in:
parent
50a9c62d0e
commit
284419b355
@ -1552,16 +1552,19 @@ class QubesVm(object):
|
|||||||
return retcode
|
return retcode
|
||||||
|
|
||||||
def run_service(self, service, source="dom0", user=None,
|
def run_service(self, service, source="dom0", user=None,
|
||||||
passio_popen = False, input=None):
|
passio_popen=False, input=None, localcmd=None):
|
||||||
if input and passio_popen:
|
if bool(input) + bool(passio_popen) + bool(localcmd) > 1:
|
||||||
raise ValueError("'input' and 'passio_popen' cannot be used "
|
raise ValueError("'input', 'passio_popen', 'localcmd' cannot be "
|
||||||
"together")
|
"used together")
|
||||||
if input:
|
if localcmd:
|
||||||
return self.run("QUBESRPC %s %s" % (service, source),
|
return self.run("QUBESRPC %s %s" % (service, source),
|
||||||
localcmd="echo %s" % input, user=user, wait=True)
|
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:
|
else:
|
||||||
return self.run("QUBESRPC %s %s" % (service, source),
|
return self.run("QUBESRPC %s %s" % (service, source),
|
||||||
passio_popen=passio_popen, user=user, wait=True)
|
passio_popen=passio_popen, user=user, wait=True)
|
||||||
|
|
||||||
def attach_network(self, verbose = False, wait = True, netvm = None):
|
def attach_network(self, verbose = False, wait = True, netvm = None):
|
||||||
self.log.debug('attach_network(netvm={!r})'.format(netvm))
|
self.log.debug('attach_network(netvm={!r})'.format(netvm))
|
||||||
|
Loading…
Reference in New Issue
Block a user