← Back to team overview

ubuntu-bugcontrol team mailing list archive

[Merge] ~jslarraz/ubuntu-qa-tools:minor-fixes into ubuntu-qa-tools:master

 

Jorge Sancho Larraz has proposed merging ~jslarraz/ubuntu-qa-tools:minor-fixes into ubuntu-qa-tools:master.

Commit message:
uvt: minor fixes

Requested reviews:
  Ubuntu Bug Control (ubuntu-bugcontrol)

For more details, see:
https://code.launchpad.net/~jslarraz/ubuntu-qa-tools/+git/ubuntu-qa-tools/+merge/460670

Several minor fixes and improvements
-- 
Your team Ubuntu Bug Control is requested to review the proposed merge of ~jslarraz/ubuntu-qa-tools:minor-fixes into ubuntu-qa-tools:master.
diff --git a/vm-tools/uvt b/vm-tools/uvt
index c7b0143..83bb504 100755
--- a/vm-tools/uvt
+++ b/vm-tools/uvt
@@ -1651,7 +1651,8 @@ def create_vm(release_iso, vm_name, arch, bridge, release, release_num, vnc,
     '''Creates a new vm with virt-install'''
 
     # https://launchpad.net/bugs/1827512
-    rc, out = runcmd(['virsh', 'capabilities'])
+    rc, out = runcmd(['virsh', "--connect", uvt_conf["vm_connect"],
+                     'capabilities'])
     if rc != 0:
         print("ERROR: problem running 'virsh capabilities':\n%s" % out,
               file=sys.stderr)
@@ -1696,7 +1697,7 @@ def create_vm(release_iso, vm_name, arch, bridge, release, release_num, vnc,
     vm_net = get_vm_net(release_num)
 
     args = [ 'virt-install',
-             '--connect=qemu:///system',
+             '--connect=' + uvt_conf["vm_connect"],
              '--name=' + vm_name,
              '--arch=' + virtinst_arch,
              '--cpu=host-passthrough',
@@ -3078,9 +3079,9 @@ def runcmd(command, input = None, stderr = subprocess.STDOUT,
         return [127, str(e)]
 
     out = sp.communicate(input)[0]
-    if out:
+    if out is not None:
         out = out.decode()
-    return [sp.returncode,out]
+    return [sp.returncode, out]
 
 def get_gpg_public_key(keyid=None):
     # try one specified in config file
@@ -3313,6 +3314,7 @@ def check_required_tools():
     tools = { 'virt-install' : 'virtinst',
               'xorriso'      : 'xorriso',
               'mkisofs'      : 'genisoimage',
+              'qemu-img'     : 'qemu-utils',
               'virsh'        : 'libvirt-clients',
               'virt-clone'   : 'virtinst',
               'virt-viewer'  : 'virt-viewer',
@@ -3404,10 +3406,9 @@ def load_uvt_config():
 
     keyboard = parse_config_file('/etc/default/keyboard')
 
-    # Replace $HOME variable to be compatible with old shell vm-new
+    # Replace environment variables to be compatible with old shell vm-new
     for k in config:
-        if "$HOME" in config[k]:
-            config[k] = re.sub("\$HOME", os.path.expanduser("~"), config[k])
+        config[k] = os.path.expandvars(config[k])
 
     # Set default directories
     if config.get('vm_dir_iso', "") == "":

Follow ups