From 7fb94b1bec19cb01243b6f50483a7ae4ba5b4b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Thu, 14 Dec 2017 08:49:53 +0100 Subject: [PATCH 3/3] oscontainer: ask root password in the wizard When creating a new root file system out of an downloaded image, the root password is likely to be changed. Add a field for this in the new guest wizard. --- ui/create.ui | 36 ++++++++++++++++++++++++++++++++++++ virtManager/create.py | 14 ++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) Index: virt-manager-1.4.3/ui/create.ui =================================================================== --- virt-manager-1.4.3.orig/ui/create.ui +++ virt-manager-1.4.3/ui/create.ui @@ -1901,6 +1901,42 @@ connections is not yet supported.</sm 3 + + + True + False + + + True + False + Root password: + + + False + True + 0 + + + + + True + True + False + + + + True + True + 1 + + + + + False + True + 4 + + True Index: virt-manager-1.4.3/virtManager/create.py =================================================================== --- virt-manager-1.4.3.orig/virtManager/create.py +++ virt-manager-1.4.3/virtManager/create.py @@ -465,6 +465,7 @@ class vmmCreate(vmmGObjectUI): self.widget("install-oscontainer-source-insecure").set_active(False) self.widget("install-oscontainer-bootstrap").set_active(False) self.widget("install-oscontainer-auth-options").set_expanded(False) + self.widget("install-oscontainer-rootpw").set_text("") src_model = (self.widget("install-oscontainer-source-url-combo") .get_model()) _populate_media_model(src_model, self.config.get_container_urls()) @@ -701,7 +702,8 @@ class vmmCreate(vmmGObjectUI): "install-oscontainer-notsupport-conn": not is_local, "install-oscontainer-notsupport": not vb_installed, "install-oscontainer-bootstrap": vb_enabled, - "install-oscontainer-source": vb_enabled + "install-oscontainer-source": vb_enabled, + "install-oscontainer-rootpw-box": vb_enabled } for w in oscontainer_widget_conf: self.widget(w).set_visible(oscontainer_widget_conf[w]) @@ -1329,6 +1331,10 @@ class vmmCreate(vmmGObjectUI): return self.widget("install-oscontainer-source-insecure").get_active() + def _get_config_oscontainer_root_password(self): + return self.widget("install-oscontainer-rootpw").get_text() + + def _should_skip_disk_page(self): return self._get_config_install_page() in [INSTALL_PAGE_IMPORT, INSTALL_PAGE_CONTAINER_APP, @@ -1732,6 +1738,7 @@ class vmmCreate(vmmGObjectUI): def _container_source_toggle(self, ignore): enable_src = self.widget("install-oscontainer-bootstrap").get_active() self.widget("install-oscontainer-source").set_sensitive(enable_src) + self.widget("install-oscontainer-rootpw-box").set_sensitive(enable_src) # Auto-generate a path if not specified if enable_src and not self.widget("install-oscontainer-fs").get_text(): @@ -2577,7 +2584,8 @@ class vmmCreate(vmmGObjectUI): 'dest': self.widget("install-oscontainer-fs").get_text, 'user': self._get_config_oscontainer_source_username, 'passwd': self._get_config_oscontainer_source_password, - 'insecure': self._get_config_oscontainer_isecure + 'insecure': self._get_config_oscontainer_isecure, + 'root_password': self._get_config_oscontainer_root_password, } for key, getter in list(bootstrap_arg_keys.items()): bootstrap_args[key] = getter() @@ -2733,6 +2741,8 @@ class vmmCreate(vmmGObjectUI): if bootstrap_args['user'] and bootstrap_args['passwd']: kwargs['username'] = bootstrap_args['user'] kwargs['password'] = bootstrap_args['passwd'] + if bootstrap_args['root_password']: + kwargs['root_password'] = bootstrap_args['root_password'] logging.debug('Start container bootstrap') try: virtBootstrap.bootstrap(**kwargs)