diff options
author | Cole Robinson <crobinso@redhat.com> | 2012-10-28 18:49:48 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2012-10-28 18:49:48 -0400 |
commit | 96ce9ac0b1257b66d0075c12aa572afe21eae0b0 (patch) | |
tree | c22d0f1451b37c6ba6fe6996adba80ab7be10d13 | |
parent | faaf62a397e363ceb6247396bd597cb56b33e810 (diff) | |
download | virt-manager-96ce9ac0b1257b66d0075c12aa572afe21eae0b0.tar.gz |
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.
-rwxr-xr-x | src/virt-manager.py.in | 8 | ||||
-rw-r--r-- | src/virtManager/config.py | 11 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/virt-manager.py.in b/src/virt-manager.py.in index 174978e6..8d09b28f 100755 --- a/src/virt-manager.py.in +++ b/src/virt-manager.py.in @@ -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 diff --git a/src/virtManager/config.py b/src/virtManager/config.py index 63cbc150..508fea09 100644 --- a/src/virtManager/config.py +++ b/src/virtManager/config.py @@ -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: |