[node-patches] Change in ovirt-node[master]: edit-node: Fix filename generation for non-nvra

fabiand at fedoraproject.org fabiand at fedoraproject.org
Wed May 22 08:56:22 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: edit-node: Fix filename generation for non-nvra
......................................................................

edit-node: Fix filename generation for non-nvra

Previously the filename suggestion for the output iso filename failed if
the input filename didn't follow the nvra scheme.
Now a simple suggestion is used as a fallback.

Change-Id: I3900ad6b112aa8224e13d9385b5b966f007b3857
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M tools/edit-node
1 file changed, 20 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/70/14970/1

diff --git a/tools/edit-node b/tools/edit-node
index f9e9208..86598ec 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -1609,19 +1609,28 @@
     #print "plugins", plugins
     #print "packages", packages
 
-    # Strip all iso and edited parts from the end
-    editname_prefix = re.sub("((?:\.(?:edited|iso))*)$", "", edited_iso)
-    nvra = isoname_to_nvr(editname_prefix)
-    #print "edited nvra", nvra
-
     packages = "_".join(packages)
 
-    isoname = "{name}-{version}-{release}.{packages}.{distro}.iso".format(
-        name=nvra[0],
-        version=nvra[1],
-        release=nvra[2],
-        packages=packages,
-        distro=nvra[4])
+    # Strip all iso and edited parts from the end
+    editname_prefix = re.sub("((?:\.(?:edited|iso))*)$", "", edited_iso)
+
+    isoname = None
+    try:
+        nvra = isoname_to_nvr(editname_prefix)
+        #print "edited nvra", nvra
+        isoname = "{name}-{version}-{release}.{packages}.{distro}.iso".format(
+            name=nvra[0],
+            version=nvra[1],
+            release=nvra[2],
+            packages=packages,
+            distro=nvra[4])
+    except Exception as e:
+        logging.exception("ISO Filename '%s' doesn't follow NVRA scheme" %
+                          editname_prefix, e)
+
+        isoname = "{name}.{packages}.iso".format(name=editname_prefix,
+                                                 packages=packages)
+
     return isoname
 
 if __name__ == "__main__":


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3900ad6b112aa8224e13d9385b5b966f007b3857
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list