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:
Cole Robinson 2012-10-28 18:49:48 -04:00
parent faaf62a397
commit 96ce9ac0b1
2 changed files with 17 additions and 2 deletions

View File

@ -121,6 +121,11 @@ def parse_commandline():
optParser.add_option("--trace-libvirt", dest="tracelibvirt",
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",
help="Connect to hypervisor at URI", metavar="URI")
optParser.add_option("--debug", action="store_true", dest="debug",
@ -328,7 +333,8 @@ def main():
# display access
import virtManager.config
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
config.default_qemu_user = default_qemu_user
config.rhel6_defaults = rhel_enable_unsupported_opts

View File

@ -88,11 +88,12 @@ class vmmConfig(object):
DEFAULT_VIRT_IMAGE_DIR = "/var/lib/libvirt/images"
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.appversion = appversion
self.conf_dir = "/apps/" + appname
self.ui_dir = ui_dir
self.test_first_run = bool(test_first_run)
self.conf = gconf.client_get_default()
self.conf.add_dir(self.conf_dir, gconf.CLIENT_PRELOAD_NONE)
@ -590,6 +591,9 @@ class vmmConfig(object):
# Manager view connection list
def add_conn(self, uri):
if self.test_first_run:
return
uris = self.conf.get_list(self.conf_dir + "/connections/uris",
gconf.VALUE_STRING)
if uris == None:
@ -619,6 +623,8 @@ class vmmConfig(object):
gconf.VALUE_STRING, uris)
def get_conn_uris(self):
if self.test_first_run:
return []
return self.conf.get_list(self.conf_dir + "/connections/uris",
gconf.VALUE_STRING)
@ -638,6 +644,9 @@ class vmmConfig(object):
return ((uris is not None) and (uri in uris))
def set_conn_autoconnect(self, uri, val):
if self.test_first_run:
return
uris = self.conf.get_list(self.conf_dir + "/connections/autoconnect",
gconf.VALUE_STRING)
if uris is None: