File virtman-check-for-valid-display.patch of Package virt-manager.7890

References: bnc#907958
Sanity check for those who forget '-X' on ssh and try to start virt-manager
Index: virt-manager-1.4.2/virt-manager
===================================================================
--- virt-manager-1.4.2.orig/virt-manager
+++ virt-manager-1.4.2/virt-manager
@@ -81,8 +81,11 @@ def _import_gtk(leftovers):
             print("gtk3 3.14.0 or later is required.")
             sys.exit(1)
 
-        # This will error if Gtk wasn't correctly initialized
-        Gtk.init()
+        if os.environ.has_key('DISPLAY') and os.environ['DISPLAY']:
+            # This will error if Gtk wasn't correctly initialized
+            Gtk.Window()
+        else:
+            raise Exception("Error starting virt-manager: No graphical display found")
 
         globals()["Gtk"] = Gtk
         import virtManager.config
openSUSE Build Service is sponsored by