From 80411610aa25dab878556dd2e59693967d6d8498 Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Thu, 25 Apr 2013 16:03:04 +0300 Subject: [PATCH] Handle better images with distro="unknown" If the ostype returned by libguestfs is valid and distro in unknown, don't print the distro at all. --- image_creator/dialog_main.py | 3 ++- image_creator/image.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/image_creator/dialog_main.py b/image_creator/dialog_main.py index d2c9182..7e6b33d 100644 --- a/image_creator/dialog_main.py +++ b/image_creator/dialog_main.py @@ -99,7 +99,8 @@ def create_image(d, media, out, tmp): "image creation process?\n\nChoose to run the wizard," \ " 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) diff --git a/image_creator/image.py b/image_creator/image.py index a5804a3..7d1ddfe 100644 --- a/image_creator/image.py +++ b/image_creator/image.py @@ -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""" -- 1.7.10.4