[jenkins-ci PATCH v2] lcitool: check for virt-install / ansible-playbook in $PATH

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

 



This improves error reporting:

  $ ./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é <berrange@xxxxxxxxxx>
---
 guests/lcitool | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 0f60704..d3937be 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -17,6 +17,7 @@
 # with this program. If not, see <https://www.gnu.org/licenses/>.
 
 import argparse
+import distutils.spawn
 import fnmatch
 import json
 import os
@@ -461,8 +462,12 @@ class Application:
             "git_branch": git_branch,
         })
 
+        ap_path = distutils.spawn.find_executable("ansible-playbook")
+        if ap_path is None:
+            raise Exception("Cannot find ansible-playbook in $PATH")
+
         cmd = [
-            "ansible-playbook",
+            ap_path,
             "--limit", ansible_hosts,
             "--extra-vars", extra_vars,
         ]
@@ -534,8 +539,12 @@ class Application:
             # a kernel argument
             extra_arg = "console=ttyS0 ks=file:/{}".format(install_config)
 
+            vi_path = distutils.spawn.find_executable("virt-install")
+            if vi_path is None:
+                raise Exception("Cannot find virt-install in $PATH")
+
             cmd = [
-                "virt-install",
+                vi_path,
                 "--name", host,
                 "--location", facts["install_url"],
                 "--virt-type", facts["install_virt_type"],
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux