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.
This commit is contained in:
Cédric Bosdonnat 2017-12-19 17:32:18 +01:00 committed by Cole Robinson
parent 03e827b24b
commit 50fd011153
2 changed files with 48 additions and 2 deletions

View File

@ -1891,6 +1891,42 @@ connections is not yet supported.&lt;/small&gt;</property>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="install-oscontainer-rootpw-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Root password:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="install-oscontainer-rootpw">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>

View File

@ -444,6 +444,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())
@ -680,7 +681,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])
@ -1308,6 +1310,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,
@ -1652,6 +1658,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():
@ -2497,7 +2504,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 bootstrap_arg_keys.items():
bootstrap_args[key] = getter()
@ -2653,6 +2661,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)