From: Lucas Meneghel Rodrigues Subject: [PATCH] unattended.py: Make sure qemu-img built from git is used Date: Thu, 6 Jan 2011 18:21:00 -0200 Message-ID: <1294345260-11586-1-git-send-email-lmr@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: autotest@test.kernel.org Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Rather than what it was found on the user's PATH. Signed-off-by: Lucas Meneghel Rodrigues --- client/tests/kvm/scripts/unattended.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) 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 ' -- 1.7.3.4