details: show warning when guest inspection fails

If libguestfs fails to inspect the guest then show a warning.

Now the "Operating System" and "Applications" frames are visible
only when the guest inspection is available.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=755869

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2013-11-25 16:10:03 +01:00
parent b3131e828e
commit 0abbb6d122
2 changed files with 937 additions and 868 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2503,38 +2503,48 @@ class vmmDetails(vmmGObjectUI):
self.widget("overview-arch").set_text(arch)
self.widget("overview-emulator").set_text(emu)
inspection_supported = self.config.support_inspection
uihelpers.set_grid_row_visible(self.widget("details-overview-error"),
self.vm.inspection.error)
if self.vm.inspection.error:
msg = _("Error while inspecting the guest configuration")
self.widget("details-overview-error").set_text(msg)
# Operating System (ie. inspection data)
hostname = self.vm.inspection.hostname
if not hostname:
hostname = _("unknown")
self.widget("inspection-hostname").set_text(hostname)
product_name = self.vm.inspection.product_name
if not product_name:
product_name = _("unknown")
self.widget("inspection-product-name").set_text(product_name)
self.widget("details-inspection-os").set_visible(inspection_supported)
if inspection_supported:
hostname = self.vm.inspection.hostname
if not hostname:
hostname = _("unknown")
self.widget("inspection-hostname").set_text(hostname)
product_name = self.vm.inspection.product_name
if not product_name:
product_name = _("unknown")
self.widget("inspection-product-name").set_text(product_name)
# Applications (also inspection data)
apps = self.vm.inspection.applications or []
self.widget("details-inspection-apps").set_visible(inspection_supported)
if inspection_supported:
apps = self.vm.inspection.applications or []
apps_list = self.widget("inspection-apps")
apps_model = apps_list.get_model()
apps_model.clear()
for app in apps:
name = ""
if app["app_name"]:
name = app["app_name"]
if app["app_display_name"]:
name = app["app_display_name"]
version = ""
if app["app_version"]:
version = app["app_version"]
if app["app_release"]:
version += "-" + app["app_release"]
summary = ""
if app["app_summary"]:
summary = app["app_summary"]
apps_list = self.widget("inspection-apps")
apps_model = apps_list.get_model()
apps_model.clear()
for app in apps:
name = ""
if app["app_name"]:
name = app["app_name"]
if app["app_display_name"]:
name = app["app_display_name"]
version = ""
if app["app_version"]:
version = app["app_version"]
if app["app_release"]:
version += "-" + app["app_release"]
summary = ""
if app["app_summary"]:
summary = app["app_summary"]
apps_model.append([name, version, summary])
apps_model.append([name, version, summary])
# Machine settings
acpi = self.vm.get_acpi()