[PATCH 12/16] Virt: small fixes related to libvirt unattended install when using auto url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds a simple formatting chance (to stay withing the 79 cols),
and two small fixes to parameter parsing when using auto url feature.

Signed-off-by: Cleber Rosa <crosa@xxxxxxxxxx>
---
 client/virt/libvirt_vm.py               |    9 ++++++---
 client/virt/tests/unattended_install.py |    8 +++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index f29cdc4..129c214 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -533,9 +533,10 @@ class VM(virt_vm.BaseVM):
         # Clone this VM using the new params
         vm = self.clone(name, params, root_dir, copy_state=True)
 
-        virt_install_binary = virt_utils.get_path(root_dir,
-                                    params.get("virt_install_binary",
-                                    "virt-install"))
+        virt_install_binary = virt_utils.get_path(
+            root_dir,
+            params.get("virt_install_binary",
+                       "virt-install"))
 
         help = utils.system_output("%s --help" % virt_install_binary)
 
@@ -573,6 +574,8 @@ class VM(virt_vm.BaseVM):
         if params.get("medium") == 'url':
             if params.get("url") == 'auto':
                 location = params.get('auto_content_url')
+            else:
+                location = params.get('url')
 
         elif params.get("medium") == 'kernel_initrd':
             # directory location of kernel/initrd pair (directory layout must
diff --git a/client/virt/tests/unattended_install.py b/client/virt/tests/unattended_install.py
index daeb453..862ea80 100644
--- a/client/virt/tests/unattended_install.py
+++ b/client/virt/tests/unattended_install.py
@@ -528,12 +528,14 @@ class UnattendedInstallConfig(object):
         ks_param = 'ks=http://%s:%s/%s' % (self.url_auto_content_ip,
                                            self.unattended_server_port,
                                            dest_fname)
-        if 'ks=' in getattr(self, 'extra_params'):
+        self.extra_params = getattr(self, 'extra_params')
+        if 'ks=' in self.extra_params:
             extra_params = re.sub('ks\=[\w\d\:\.\/]+',
                                   ks_param,
-                                  getattr(self, 'extra_params'))
+                                  self.extra_params)
         else:
-            extra_params += ' %s ' % ks_param
+            extra_params = '%s %s' % (self.extra_params,
+                                      ks_param)
 
         # reflect change on params
         self.extra_params = extra_params
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux