Handle better images with distro="unknown"
authorNikos Skalkotos <skalkoto@grnet.gr>
Thu, 25 Apr 2013 13:03:04 +0000 (16:03 +0300)
committerNikos Skalkotos <skalkoto@grnet.gr>
Thu, 25 Apr 2013 13:21:47 +0000 (16:21 +0300)
If the ostype returned by libguestfs is valid and distro in unknown,
don't print the distro at all.

image_creator/dialog_main.py
image_creator/image.py

index d2c9182..7e6b33d 100644 (file)
@@ -99,7 +99,8 @@ def create_image(d, media, out, tmp):
               "image creation process?\n\nChoose <Wizard> to run the wizard," \
               " <Expert> to run the snf-image-creator in expert mode or " \
               "press ESC to quit the program." \
-              % (image.ostype if image.ostype == image.distro else "%s (%s)" %
+              % (image.ostype if image.ostype == image.distro or
+                 image.distro == "unknown" else "%s (%s)" %
                  (image.ostype, image.distro))
 
         update_background_title(session)
index a5804a3..7d1ddfe 100644 (file)
@@ -107,7 +107,9 @@ class Image(object):
 
         self.ostype = self.g.inspect_get_type(self.root)
         self.distro = self.g.inspect_get_distro(self.root)
-        self.out.success('found a(n) %s system' % self.distro)
+        self.out.success(
+            'found a(n) %s system' %
+            self.ostype if self.distro == "unknown" else self.distro)
 
     def _get_os(self):
         """Return an OS class instance for this image"""