diff mbox

unattended.py: Make sure qemu-img built from git is used

Message ID 1294345260-11586-1-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues Jan. 6, 2011, 8:21 p.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/scripts/unattended.py b/client/tests/kvm/scripts/unattended.py
index e9e4751..61c3326 100755
--- a/client/tests/kvm/scripts/unattended.py
+++ b/client/tests/kvm/scripts/unattended.py
@@ -24,6 +24,8 @@  def find_command(cmd):
 
     @param cmd: Command to be found.
     """
+    if os.path.exists(cmd):
+        return cmd
     for dir in ["/usr/local/sbin", "/usr/local/bin",
                 "/usr/sbin", "/usr/bin", "/sbin", "/bin"]:
         file = os.path.join(dir, cmd)
@@ -119,9 +121,8 @@  class FloppyDisk(Disk):
     """
     def __init__(self, path):
         print "Creating floppy unattended image %s" % path
-        try:
-            qemu_img_binary = os.environ['KVM_TEST_qemu_img_binary']
-        except KeyError:
+        qemu_img_binary = os.environ['KVM_TEST_qemu_img_binary']
+        if not os.path.isabs(qemu_img_binary):
             qemu_img_binary = os.path.join(KVM_TEST_DIR, qemu_img_binary)
         if not os.path.exists(qemu_img_binary):
             raise SetupError('The qemu-img binary that is supposed to be used '