[node-patches] Change in ovirt-node[master]: Let edit-node install multiple packages

rbarry at redhat.com rbarry at redhat.com
Tue Oct 22 18:13:07 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Let edit-node install multiple packages
......................................................................

Let edit-node install multiple packages

Previously, the manpage specified one syntax for installing
multiple packages, but edit-node did not parse it correctly. Make
the behaviour match the manpage.

Change-Id: Ic6973a43641a8f540d2237d4a5afcf27d8741a97
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=991289
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M tools/edit-node
1 file changed, 24 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/07/20407/1

diff --git a/tools/edit-node b/tools/edit-node
index 7a78f2f..b6b1274 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -1270,17 +1270,28 @@
             print "\nERROR: Yum Is Not Installed Within The ISO\n"
             self._cleanup_editing()
             return False
-        if os.path.isfile(pkgs):
-            os.system("mkdir %s/tmp/yumrepo" % self._instroot)
-            os.system("touch %s/tmp/yumrepo/%s" % (self._instroot,
-                      os.path.basename(pkgs)))
-            os.system("mount -o bind %s %s/tmp/yumrepo/%s" %
-                      (pkgs, self._instroot, os.path.basename(pkgs)))
-            print os.listdir("%s/tmp/yumrepo" % self._instroot)
-            yum_cmd = "yum localinstall -y /tmp/yumrepo/%s" % \
-                os.path.basename(pkgs)
+        pkgs = pkgs.split(",")
+        localinstall = []
+        remoteinstall = []
+        for pkg in pkgs:
+            if os.path.isfile(pkg):
+                os.system("mkdir %s/tmp/yumrepo" % self._instroot)
+                os.system("touch %s/tmp/yumrepo/%s" % (self._instroot,
+                          os.path.basename(pkg)))
+                os.system("mount -o bind %s %s/tmp/yumrepo/%s" %
+                          (pkg, self._instroot, os.path.basename(pkg)))
+                print os.listdir("%s/tmp/yumrepo" % self._instroot)
+                localinstall.append("/tmp/yumrepo/%s" % os.path.basename(pkg))
+            else:
+                remoteinstall.append(pkg)
+
+        if len(localinstall) > 0:
+            yum_cmd = "yum localinstall -y %s" % " ".join(localinstall)
         else:
-            yum_cmd = "yum install -y %s " % pkgs
+            yum_cmd = "yum install -y %s" % " ".join(remoteinstall)
+
+        if len(remoteinstall) > 0 and len(localinstall) > 0:
+            self._run_yum_install(",".join(remoteinstall))
         # make sure rpm keys are imported
         rpm_cmd = "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*"
         rpm = subprocess.Popen(rpm_cmd, shell=True, stdout=PIPE,
@@ -1296,8 +1307,9 @@
             self._cleanup_editing()
             return False
         if "localinstall" in yum_cmd:
-            os.system("umount %s/tmp/yumrepo/%s" % (self._instroot,
-                      os.path.basename(pkgs)))
+            for pkg in pkgs:
+                os.system("umount %s/tmp/yumrepo/%s" % (self._instroot,
+                          os.path.basename(pkg)))
             os.system("rm -rf %s/tmp/yumrepo" % self._instroot)
         return True
 


-- 
To view, visit http://gerrit.ovirt.org/20407
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6973a43641a8f540d2237d4a5afcf27d8741a97
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list