[node-patches] Change in ovirt-node[ovirt-3.5]: edit-node: fix --install=package.rpm use

dougsland at redhat.com dougsland at redhat.com
Thu Sep 4 15:17:45 UTC 2014


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: edit-node: fix --install=package.rpm use
......................................................................

edit-node: fix --install=package.rpm use

In commit c7845d3b29a we introduced the use of '*' for non
.rpm packages. However, this patch requires a fix to keep
compatibility to .rpm use.

Change-Id: I0541f9a11c6a591aeb4b1bb98789f6f27d14ba52
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1133482
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M tools/edit-node
1 file changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/00/32500/1

diff --git a/tools/edit-node b/tools/edit-node
index 573df52..8f66cd7 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -675,11 +675,17 @@
             plugin_info_dir = "%s/etc/ovirt-plugins.d" % self._instroot
             os.system("mkdir -p %s" % plugin_info_dir)
             for pkg in pkg.split(","):
-                pkgfilename = re.sub("\.(rpm)$", "", os.path.basename(pkg))
+                if pkg.endswith(".rpm"):
+                    pkg = re.sub("\.(rpm)$", "", os.path.basename(pkg))
+                    rpm_flags = "-q"
+                else:
+                    rpm_flags = "-qa"
+
+                pkgfilename = pkg.strip("*")
 
                 # get name#version-release
-                cmd = "rpm -qa %s --qf '%%{name}#%%{version}-" \
-                    "%%{release}.%%{arch}\n'" % pkgfilename
+                cmd = "rpm %s %s --qf '%%{name}#%%{version}-" \
+                    "%%{release}.%%{arch}\n'" % (rpm_flags, pkgfilename)
                 f = subprocess.Popen(cmd,
                                      shell=True,
                                      stdout=PIPE,
@@ -687,11 +693,14 @@
                                      preexec_fn=self._chroot)
                 namevr, err = f.communicate()
 
+                if "is not installed" in namevr:
+                    continue
+
                 for nvr in namevr.split("\n"):
                     if not nvr:
                         break
 
-                    pkgname, pkgversion = nvr.strip("*").split("#")
+                    pkgname, pkgversion = nvr.split("#")
                     # get install date
                     cmd = "LC_ALL=C rpm -q %s --qf '%%{INSTALLTIME:date}\n'" \
                         % pkgname


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0541f9a11c6a591aeb4b1bb98789f6f27d14ba52
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list