mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Add hidden --test-first-run switch for testing PackageKit bits
Basically stubs out the gconf URI fetching + listing so we don't need to delete anything to trigger it.
This commit is contained in:
parent
faaf62a397
commit
96ce9ac0b1
@ -121,6 +121,11 @@ def parse_commandline():
|
|||||||
optParser.add_option("--trace-libvirt", dest="tracelibvirt",
|
optParser.add_option("--trace-libvirt", dest="tracelibvirt",
|
||||||
help=optparse.SUPPRESS_HELP, action="store_true")
|
help=optparse.SUPPRESS_HELP, action="store_true")
|
||||||
|
|
||||||
|
# Don't load any connections on startup to test first run
|
||||||
|
# PackageKit integration
|
||||||
|
optParser.add_option("--test-first-run", dest="testfirstrun",
|
||||||
|
help=optparse.SUPPRESS_HELP, action="store_true")
|
||||||
|
|
||||||
optParser.add_option("-c", "--connect", dest="uri",
|
optParser.add_option("-c", "--connect", dest="uri",
|
||||||
help="Connect to hypervisor at URI", metavar="URI")
|
help="Connect to hypervisor at URI", metavar="URI")
|
||||||
optParser.add_option("--debug", action="store_true", dest="debug",
|
optParser.add_option("--debug", action="store_true", dest="debug",
|
||||||
@ -328,7 +333,8 @@ def main():
|
|||||||
# display access
|
# display access
|
||||||
import virtManager.config
|
import virtManager.config
|
||||||
import virtManager.util
|
import virtManager.util
|
||||||
config = virtManager.config.vmmConfig(appname, appversion, ui_dir)
|
config = virtManager.config.vmmConfig(appname, appversion, ui_dir,
|
||||||
|
options.test_first_run)
|
||||||
virtManager.util.running_config = config
|
virtManager.util.running_config = config
|
||||||
config.default_qemu_user = default_qemu_user
|
config.default_qemu_user = default_qemu_user
|
||||||
config.rhel6_defaults = rhel_enable_unsupported_opts
|
config.rhel6_defaults = rhel_enable_unsupported_opts
|
||||||
|
@ -88,11 +88,12 @@ class vmmConfig(object):
|
|||||||
DEFAULT_VIRT_IMAGE_DIR = "/var/lib/libvirt/images"
|
DEFAULT_VIRT_IMAGE_DIR = "/var/lib/libvirt/images"
|
||||||
DEFAULT_VIRT_SAVE_DIR = "/var/lib/libvirt"
|
DEFAULT_VIRT_SAVE_DIR = "/var/lib/libvirt"
|
||||||
|
|
||||||
def __init__(self, appname, appversion, ui_dir):
|
def __init__(self, appname, appversion, ui_dir, test_first_run=False):
|
||||||
self.appname = appname
|
self.appname = appname
|
||||||
self.appversion = appversion
|
self.appversion = appversion
|
||||||
self.conf_dir = "/apps/" + appname
|
self.conf_dir = "/apps/" + appname
|
||||||
self.ui_dir = ui_dir
|
self.ui_dir = ui_dir
|
||||||
|
self.test_first_run = bool(test_first_run)
|
||||||
|
|
||||||
self.conf = gconf.client_get_default()
|
self.conf = gconf.client_get_default()
|
||||||
self.conf.add_dir(self.conf_dir, gconf.CLIENT_PRELOAD_NONE)
|
self.conf.add_dir(self.conf_dir, gconf.CLIENT_PRELOAD_NONE)
|
||||||
@ -590,6 +591,9 @@ class vmmConfig(object):
|
|||||||
|
|
||||||
# Manager view connection list
|
# Manager view connection list
|
||||||
def add_conn(self, uri):
|
def add_conn(self, uri):
|
||||||
|
if self.test_first_run:
|
||||||
|
return
|
||||||
|
|
||||||
uris = self.conf.get_list(self.conf_dir + "/connections/uris",
|
uris = self.conf.get_list(self.conf_dir + "/connections/uris",
|
||||||
gconf.VALUE_STRING)
|
gconf.VALUE_STRING)
|
||||||
if uris == None:
|
if uris == None:
|
||||||
@ -619,6 +623,8 @@ class vmmConfig(object):
|
|||||||
gconf.VALUE_STRING, uris)
|
gconf.VALUE_STRING, uris)
|
||||||
|
|
||||||
def get_conn_uris(self):
|
def get_conn_uris(self):
|
||||||
|
if self.test_first_run:
|
||||||
|
return []
|
||||||
return self.conf.get_list(self.conf_dir + "/connections/uris",
|
return self.conf.get_list(self.conf_dir + "/connections/uris",
|
||||||
gconf.VALUE_STRING)
|
gconf.VALUE_STRING)
|
||||||
|
|
||||||
@ -638,6 +644,9 @@ class vmmConfig(object):
|
|||||||
return ((uris is not None) and (uri in uris))
|
return ((uris is not None) and (uri in uris))
|
||||||
|
|
||||||
def set_conn_autoconnect(self, uri, val):
|
def set_conn_autoconnect(self, uri, val):
|
||||||
|
if self.test_first_run:
|
||||||
|
return
|
||||||
|
|
||||||
uris = self.conf.get_list(self.conf_dir + "/connections/autoconnect",
|
uris = self.conf.get_list(self.conf_dir + "/connections/autoconnect",
|
||||||
gconf.VALUE_STRING)
|
gconf.VALUE_STRING)
|
||||||
if uris is None:
|
if uris is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user