From nobody Sat Feb 7 06:38:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556804686; cv=none; d=zoho.com; s=zohoarc; b=b6SATwPrnC8ldRYtFGmCK6yI8/zQ8MlLgar8NV1gR6DYqqJwyrL5/+4HDIcNSf857XSmvgs/suDzpnNchacYNAkWydJ4HCM93stEeTCOw2yNq1mDrRN+3huFdo5H5k/f3szj2/I+1CS4u+RLBEohR6oVuTyB8+7P7wvVO8Eg3L0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556804686; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=6miEN+uLRhib4DkMnCO8EHUfyVTyEPXIumL+qFeXtXI=; b=SDloOFmRfCsiUs1lnaNGdAzLyaI23U0fWgWmpRL2g8s4yorPku3iBleLK9FS58Xd6ANsB2mbQhw7n5vl76ORM9vC/IbaBzRd3EltT0FJ/jlR6ncMNiSQKyzuZIYUuZr7EwnaFOJPECe1BOvYD/TJHz2yQmsYuxny5mt5zTDHk1I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1556804686654172.39759385762454; Thu, 2 May 2019 06:44:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3D513151C40; Thu, 2 May 2019 13:44:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38F0D5DA34; Thu, 2 May 2019 13:44:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9DAC918089CA; Thu, 2 May 2019 13:44:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x42Dicht010248 for ; Thu, 2 May 2019 09:44:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F8997D3EB; Thu, 2 May 2019 13:44:38 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FC337D3E8; Thu, 2 May 2019 13:44:35 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 2 May 2019 14:44:33 +0100 Message-Id: <20190502134433.6321-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH] lcitool: check for virt-install existing X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 02 May 2019 13:44:44 +0000 (UTC) This improves: $ ./lcitool install libvirt-fedora-29 ./lcitool: Failed to install 'libvirt-fedora-29': [Errno 2] No such file = or directory To $ ./lcitool install libvirt-fedora-29 ./lcitool: Cannot find virt-install in $PATH Signed-off-by: Daniel P. Berrang=C3=A9 --- guests/lcitool | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/guests/lcitool b/guests/lcitool index 0f60704..3be16c8 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -37,6 +37,23 @@ except ImportError: =20 class Util: =20 + @staticmethod + def which(program): + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname =3D os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + exe_file =3D os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + return None + @staticmethod def get_base(): return os.path.dirname(os.path.abspath(__file__)) @@ -534,8 +551,12 @@ class Application: # a kernel argument extra_arg =3D "console=3DttyS0 ks=3Dfile:/{}".format(install_c= onfig) =20 + vipath =3D Util.which("virt-install") + if vipath is None: + raise Exception("Cannot find virt-install in $PATH") + cmd =3D [ - "virt-install", + vipath, "--name", host, "--location", facts["install_url"], "--virt-type", facts["install_virt_type"], --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list