dom0/qvm-tools: use vm.run(...) instead of run_in_vm(vm, ...)
This commit is contained in:
parent
7c7bea6a03
commit
f7d84c9a27
@ -24,7 +24,6 @@
|
||||
from qubes.qubes import QubesVmCollection
|
||||
from qubes.qubes import QubesException
|
||||
from optparse import OptionParser
|
||||
from qubes import qubesutils
|
||||
import subprocess
|
||||
import socket
|
||||
import errno
|
||||
@ -83,7 +82,7 @@ def vm_run_cmd(vm, cmd, options):
|
||||
elif level == "error":
|
||||
tray_notify_error(str)
|
||||
|
||||
return qubesutils.run_in_vm(vm, cmd, autostart = options.auto,
|
||||
return vm.run(cmd, autostart = options.auto,
|
||||
verbose = options.verbose,
|
||||
notify_function = tray_notify_generic if options.tray else None,
|
||||
passio = options.passio, localcmd = options.localcmd)
|
||||
|
@ -21,7 +21,6 @@
|
||||
#
|
||||
|
||||
from qubes.qubes import QubesVmCollection
|
||||
from qubes.qubesutils import run_in_vm
|
||||
import os.path
|
||||
import os
|
||||
import sys
|
||||
@ -65,14 +64,14 @@ def main():
|
||||
|
||||
# Ignore retcode, try even if nm-online failed - user can setup network manually
|
||||
# on-online has timeout 30sec by default
|
||||
run_in_vm(net_vm, 'user:nm-online -x', verbose=verbose, wait=True)
|
||||
net_vm.run('user:nm-online -x', verbose=verbose, wait=True)
|
||||
|
||||
# Sync clock
|
||||
if run_in_vm(clock_vm, 'root:/etc/init.d/ntpdate restart', verbose=verbose, wait=True) != 0:
|
||||
if clock_vm.run('root:/etc/init.d/ntpdate restart', verbose=verbose, wait=True) != 0:
|
||||
print >> sys.stderr, 'Time sync failed, aborting!'
|
||||
sys.exit(1)
|
||||
|
||||
p = run_in_vm(clock_vm, 'user:date -u', verbose=verbose, passio_popen=True)
|
||||
p = clock_vm.run('user:date -u', verbose=verbose, passio_popen=True)
|
||||
date_out = p.stdout.read(100)
|
||||
if not re.match(r'^[A-Za-z]* [A-Za-z]* [ 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [A-Z]* [0-9][0-9][0-9][0-9]$', date_out):
|
||||
print >> sys.stderr, 'Invalid date output, aborting!'
|
||||
@ -90,7 +89,7 @@ def main():
|
||||
if vm.is_running() and vm.qid != 0 and vm.qid != clock_vm.qid:
|
||||
if verbose:
|
||||
print >> sys.stderr, '--> Syncing \'%s\' clock.' % vm.name
|
||||
run_in_vm(vm, 'root:date -u -s "%s"' % date_out, verbose=verbose)
|
||||
vm.run('root:date -u -s "%s"' % date_out, verbose=verbose)
|
||||
|
||||
main()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user