def on_merge(self, effective_changes): self.logger.debug("Saving SNMP page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) snmp_keys = ["snmp.password", "snmp.enabled"] txs = utils.Transaction("Updating SNMP configuration") if changes.contains_any(snmp_keys): is_enabled = effective_model["snmp.enabled"] pw = effective_model["snmp.password"] if is_enabled and len(pw) == 0: txt = "Unable to configure SNMP without a password!" self._confirm_dialog = ui.InfoDialog("dialog.confirm", "SNMP Error", txt) return self._confirm_dialog else: model = snmp_model.SNMP() model.update(is_enabled) txs += model.transaction(snmp_password=pw) progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run() return self.ui_content()
def on_merge(self, effective_changes): self.logger.debug("Saving remote storage page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) txs = utils.Transaction("Updating remote storage configuration") iscsi_keys = ["iscsi.initiator_name"] if changes.contains_any(iscsi_keys): model = defaults.iSCSI() args = effective_model.values_for(iscsi_keys) args += [None, None, None] # No target config model.update(*args) txs += model.transaction() nfsv4_keys = ["nfsv4.domain"] if changes.contains_any(nfsv4_keys): model = defaults.NFSv4() args = effective_model.values_for(nfsv4_keys) model.update(*args) txs += model.transaction() progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): self.logger.info("Saving Puppet config") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) puppet_keys = ["puppet.enabled", "puppet.server", "puppet.certname"] if changes.contains_any(puppet_keys): Puppet().update(*effective_model.values_for(puppet_keys)) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) txs = utils.Transaction("Configuring Puppet") if effective_changes.contains_any(["action.register"]): self.logger.debug("Connecting to puppet") txs += [ActivatePuppet()] if len(txs) > 0: progress_dialog = ui.TransactionProgressDialog( "dialog.txs", txs, self) progress_dialog.run() # Acts like a page reload return self.ui_content()
def on_merge(self, effective_changes): self.logger.debug("Saving logging page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) txs = utils.Transaction(_("Updating logging related configuration")) # If any logrotate key changed ... logrotate_keys = ["logrotate.max_size", "logrotate.interval"] if changes.contains_any(logrotate_keys): # Get all logrotate values fomr the effective model model = defaults.Logrotate() # And update the defaults model.update(*effective_model.values_for(logrotate_keys)) txs += model.transaction() rsyslog_keys = ["rsyslog.address", "rsyslog.port"] if changes.contains_any(rsyslog_keys): model = defaults.Syslog() model.update(*effective_model.values_for(rsyslog_keys)) txs += model.transaction() netconsole_keys = ["netconsole.address", "netconsole.port"] if changes.contains_any(netconsole_keys): model = defaults.Netconsole() model.update(*effective_model.values_for(netconsole_keys)) txs += model.transaction() progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): # changes will only contain changes compared to the original # contents effective_model = self.model() effective_model.update(effective_changes) # Using the effective_model ensures that we've always got a # profile if "tuned.profile" in effective_changes: model = tunedconf.Tuned() # Set keys: model.update(effective_model["tuned.profile"]) # Get transaction for keys: txs = model.transaction() # Run transaction in nice UI: ui.TransactionProgressDialog("dialog.txs", txs, self).run()
def on_merge(self, effective_changes): self.logger.debug("Saving security page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) ssh_keys = [ "ssh.pwauth", "strongrng.num_bytes", "strongrng.disable_aesni" ] passwd_keys = [ "passwd.admin.password", "passwd.admin.password_confirmation" ] txs = utils.Transaction("Updating security configuration") if changes.contains_any(ssh_keys): model = defaults.SSH() model.update(*effective_model.values_for(ssh_keys)) txs += model.transaction() if changes.contains_any(passwd_keys): pw, pwc = effective_model.values_for(passwd_keys) if pw != pwc: raise exceptions.InvalidData("Passwords do not match") passwd = utils.security.Passwd() # Create a custom transaction element, because the password # is not handled/saved in the defaults file class SetAdminPasswd(utils.Transaction.Element): title = "Setting admin password" def commit(self): self.logger.debug("Setting admin password.") passwd.set_password("admin", pw) txs += [SetAdminPasswd()] progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): self.logger.debug("Saving monitoring page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) collectd_keys = ["collectd.address", "collectd.port"] txs = utils.Transaction(_("Updating monitoring configuration")) if changes.contains_any(collectd_keys): model = defaults.Collectd() model.update(*effective_model.values_for(collectd_keys)) txs += model.transaction() progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): self.logger.debug("Saving keyboard page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) layout_keys = ["keyboard.layout"] txs = utils.Transaction("Updating keyboard related configuration") if changes.contains_any(layout_keys): model = defaults.Keyboard() model.update(*effective_model.values_for(layout_keys)) txs += model.transaction() progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): self.logger.debug("Saving CIM page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) cim_keys = ["cim.password_confirmation", "cim.enabled"] txs = utils.Transaction("Updating CIM configuration") if changes.contains_any(cim_keys): is_enabled = effective_model["cim.enabled"] pw = effective_model["cim.password_confirmation"] model = cim_model.CIM() model.update(is_enabled) txs += model.transaction(cim_password=pw) progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): self.logger.debug("Saving hostname page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) collectd_keys = ["collectd.ip", "collectd.hostname"] txs = utils.Transaction("Add Node hostname to the Engine") if changes.contains_any(collectd_keys): model = defaults.Hostname() model.update(*effective_model.values_for(collectd_keys)) args = effective_model.values_for(collectd_keys) txs += [Hostname(args[0], args[1])] txs += model.transaction() progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): model = NodeManagement() changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) txs = utils.Transaction( "Configuring {engine_name}".format(engine_name=config.engine_name)) if changes.contains_any(["vdsm_cfg.password"]): txs += [ SetRootPassword(password=effective_model["vdsm_cfg.password"]) ] if effective_model["vdsm_cfg.address"]: if validate_server(effective_model["vdsm_cfg.address"]): self._server, self._port = \ effective_model["vdsm_cfg.address"].split(":") else: self._server = effective_model["vdsm_cfg.address"] self._port = config.ENGINE_PORT txs += [NodeRegister(self._server, self._port)] model.update(mserver=self._server, mport=self._port) if len(txs) > 0: progress_dialog = ui.TransactionProgressDialog( "dialog.txs", txs, self) progress_dialog.run() # VDSM messes with logging, and we just reset it log.configure_logging() # Acts like a page reload return self.ui_content()
def on_merge(self, effective_changes): self.logger.debug("Saving SNMP page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) snmp_keys = ["snmp.password_confirmation", "snmp.enabled"] txs = utils.Transaction("Updating SNMP configuration") if changes.contains_any(snmp_keys): values = effective_model.values_for(snmp_keys) args = [values[0]] if values[1] is False: # If set to disabled, set password to None args[0] = None model = snmp_model.SNMP() model.update(*args) txs += model.transaction() progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run()
def on_merge(self, effective_changes): def close_dialog(): if self._dialog: self._dialog.close() self._dialog = None self._install_ready = False self._invalid_download = False self.temp_cfg_file = False effective_changes = Changeset(effective_changes) changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) if "button.dialog" in effective_changes: self._dialog = DeployDialog("Deploy Hosted Engine", self) self.widgets.add(self._dialog) return self._dialog if "button.status" in effective_changes: try: contents = utils.process.check_output( ["hosted-engine", "--vm-status"], stderr=utils.process.STDOUT ) except utils.process.CalledProcessError: contents = "\nFailed to collect hosted engine vm status, " \ "check ovirt-ha-broker logs." self.application.show(self.ui_content()) return ui.TextViewDialog("output.dialog", "Hosted Engine VM " "Status", contents) if "button.maintenance" in effective_changes: self._dialog = MaintenanceDialog("Hosted Engine Maintenance", self) self.widgets.add(self._dialog) return self._dialog if "maintenance.confirm" in effective_changes: close_dialog() if "maintenance.level" in effective_changes: level = effective_changes["maintenance.level"] try: utils.process.check_call(["hosted-engine", "--set-maintenance", "--mode=%s" % level]) except: self.logger.exception("Couldn't set maintenance level " "to %s" % level, exc_info=True) return ui.InfoDialog("dialog.error", "An error occurred", "Couldn't set maintenance level to " "%s. Check the logs" % level) if "deploy.additional" in effective_changes: close_dialog() def run_additional(*args): with self.application.ui.suspended(): try: utils.process.call( "reset; screen hosted-engine --deploy", shell=True) sys.stdout.write("Press <Return> to return to the TUI") console.wait_for_keypress() self.__persist_configs() except: self.logger.exception("hosted-engine failed to " "deploy!", exc_info=True) txt = ("Please set a password on the RHEV-M page of a host " "which has previously deployed hosted engine before " "continuing. This is required to retrieve the setup " "answer file") dialog = ui.ConfirmationDialog("dialog.add", "Prepare remote host", txt) yes_btn, cncl_btn = dialog.buttons yes_btn.label("Proceed") yes_btn.on_activate.connect(run_additional) return dialog if effective_changes.contains_any(["deploy.confirm"]): close_dialog() def make_tempfile(): if not os.path.exists(config.HOSTED_ENGINE_SETUP_DIR): os.makedirs(config.HOSTED_ENGINE_SETUP_DIR) if not os.path.exists(config.HOSTED_ENGINE_TEMPDIR): os.makedirs(config.HOSTED_ENGINE_TEMPDIR) temp_fd, temp_cfg_file = tempfile.mkstemp() os.close(temp_fd) return temp_cfg_file imagepath = effective_model["hosted_engine.diskpath"] pxe = effective_model["hosted_engine.pxe"] localpath = None # FIXME: dynamically enable the fields so we can't get into # this kind of situation. Selection should be ui.Options, not # a checkbox and a blank entry field # # Check whether we have unclear conditions if not imagepath and not pxe: self._model['display_message'] = "\n\nYou must enter a URL" \ " or choose PXE to install the Engine VM" return self.show_dialog() elif imagepath and pxe: self._model['display_message'] = "\n\nPlease choose either " \ "PXE or an image to " \ "retrieve, not both" return self.show_dialog() self.temp_cfg_file = make_tempfile() engine_keys = ["hosted_engine.diskpath", "hosted_engine.pxe"] txs = utils.Transaction("Setting up hosted engine") # FIXME: The "None" is for force_enable # Why are we setting force_enable? It clutters the code. We should # move force enabling it to checking for --dry instead model = HostedEngine() args = tuple(effective_model.values_for(engine_keys)) + (None,) model.update(*args) if "file://" in imagepath: localpath = imagepath[7:] elif imagepath: localpath = os.path.join(config.HOSTED_ENGINE_SETUP_DIR, os.path.basename(imagepath)) # Check whether we have enough conditions to run it right now if pxe or os.path.exists(localpath): def console_wait(event): event.wait() self._install_ready = True self.show_dialog() txs += model.transaction(self.temp_cfg_file) progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) t = threading.Thread(target=console_wait, args=(progress_dialog.event,)) t.start() progress_dialog.run() # The application doesn't wait until the progressdialog is # done, and it ends up being called asynchronously. Calling # in a thread and waiting to set threading.Event # time.sleep(5) # Otherwise start an async download else: path_parsed = urlparse(imagepath) if not path_parsed.scheme: self._model['display_message'] = ("\nCouldn't parse " "URL. please check " "it manually.") elif path_parsed.scheme == 'http' or \ path_parsed.scheme == 'https': self._show_progressbar = True self.application.show(self.ui_content()) self._image_retrieve(imagepath, config.HOSTED_ENGINE_SETUP_DIR) return self.ui_content()
def on_merge(self, effective_changes): self.logger.debug("Saving RHSM page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) rhn_keys = [ "rhn.username", "rhn.password", "rhn.profilename", "rhn.type", "rhn.url", "rhn.ca", "rhn.proxyhost", "rhn.proxyport", "rhn.proxyuser", "rhn.proxypassword", "rhn.org", "rhn.environment", "rhn.activation_key" ] if "button.proxy" in changes: description = ("Please enter the proxy details to use " + "for contacting the management server ") self._dialog = ProxyDialog("Input proxy information", description, self) self.widgets.add(self._dialog) return self._dialog if "rhn.activation_key" in changes and "rhn.username" in changes: return ui.InfoDialog( "dialog.error", "Conflicting Inputs", "Username and activationkey cannot be used " "simultaneously. Please clear one of the " "values") elif "rhn.activation_key" not in effective_model and \ ("rhn.username" not in effective_model and "rhn.password" not in effective_model): return ui.InfoDialog( "dialog.error", "Conflicting Inputs", "Username or activationkey must be set." "Please set one of the values.") txs = utils.Transaction("Updating RHSM configuration") if changes.contains_any(rhn_keys): def update_proxy(): vals = [ effective_model["rhn.proxyhost"], effective_model["rhn.proxyport"] ] proxy_str = "%s:%s" % (vals[0], vals[1]) if vals[1] else \ "%s" % vals[0] return proxy_str effective_model["rhn.proxy"] = proxy_str self.logger.debug(changes) self.logger.debug(effective_model) effective_model["rhn.type"] = effective_model["rhn.type"] or "rhn" effective_model["rhn.proxy"] = update_proxy() if \ effective_model["rhn.proxyhost"] else "" rhn_keys = [ "rhn.type", "rhn.url", "rhn.ca", "rhn.username", "rhn.profilename", "rhn.activation_key", "rhn.org", "rhn.environment", "rhn.proxy", "rhn.proxyuser" ] pw = effective_model["rhn.password"] proxypassword = effective_model["rhn.proxypassword"] warning_text = None rhn_type = effective_model["rhn.type"] if rhn_type == "sam" or rhn_type == "satellite": if not effective_model["rhn.url"] and not \ effective_model["rhn.ca"]: warning_text = "URL and CA path " elif not effective_model["rhn.ca"]: warning_text = "CA path " if warning_text: txt = "%s must not be empty!" % warning_text self._error_dialog = ui.InfoDialog("dialog.error", "RHSM Error", txt) return self._error_dialog else: model = rhn_model.RHN() model.clear() model.update(*effective_model.values_for(rhn_keys)) txs += model.transaction(password=pw, proxypass=proxypassword) progress_dialog = ui.TransactionProgressDialog( "dialog.txs", txs, self) progress_dialog.run() return self.ui_content()
def on_merge(self, effective_changes): self.logger.info("Saving network stuff") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.info("Effective changes %s" % effective_changes) self.logger.debug("Effective Model: %s" % effective_model) # Special case: A NIC was selected, display that dialog! if "nics" in changes and len(changes) == 1: iface = changes["nics"] self.logger.debug("Opening NIC Details dialog for '%s'" % iface) self._nic_dialog = NicDetailsDialog(self, iface) return self._nic_dialog if "dialog.nic.close" in changes: self._nic_dialog.close() return if "button.ping" in changes: self.logger.debug("Opening ping page") plugin_type = ovirt.node.setup.ping.Plugin self.application.switch_to_plugin(plugin_type) return # This object will contain all transaction elements to be executed txs = utils.Transaction("DNS and NTP configuration") e_changes_h = plugins.Changeset(effective_changes) nameservers = [] dns_keys = ["dns[0]", "dns[1]"] if e_changes_h.contains_any(dns_keys): nameservers += effective_model.values_for(dns_keys) if nameservers: self.logger.info("Setting new nameservers: %s" % nameservers) model = defaults.Nameservers() model.update(nameservers) txs += model.transaction() timeservers = [] ntp_keys = ["ntp[0]", "ntp[1]"] if e_changes_h.contains_any(ntp_keys): timeservers += effective_model.values_for(ntp_keys) if timeservers: self.logger.info("Setting new timeservers: %s" % timeservers) model = defaults.Timeservers() model.update(timeservers) txs += model.transaction() hostname_keys = ["hostname"] if e_changes_h.contains_any(hostname_keys): value = effective_model.values_for(hostname_keys) self.logger.info("Setting new hostname: %s" % value) model = defaults.Hostname() model.update(*value) txs += model.transaction() # For the NIC details dialog: if e_changes_h.contains_any(self._nic_details_group): # If any networking related key was changed, reconfigure networking # Fetch the values for the nic keys, they are used as arguments args = effective_model.values_for(self._nic_details_group) txs += self._configure_nic(*args) progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run() if "dialog.nic.save" in changes: # Close the remaing details dialog self._nic_dialog.close() # Behaves like a page reload return self.ui_content()
def on_merge(self, effective_changes): self.logger.debug("Saving RHN page") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.debug("Effective Model: %s" % effective_model) rhn_keys = [ "rhn.user", "rhn.password", "rhn.profilename", "rhn.type", "rhn.url", "rhn.ca", "rhn.proxyhost", "rhn.proxyport", "rhn.proxyuser", "rhn.proxypassword", "rhn.org", "rhn.activation_key" ] txs = utils.Transaction("Updating RHN configuration") if changes.contains_any(rhn_keys): self.logger.debug(changes) self.logger.debug(effective_model) user = effective_model["rhn.user"] pw = effective_model["rhn.password"] profilename = effective_model["rhn.profilename"] rhn_type = effective_model["rhn.type"] url = effective_model["rhn.url"] ca = effective_model["rhn.ca"] org = effective_model["rhn.org"] activationkey = effective_model["rhn.activation_key"] proxyhost = effective_model["rhn.proxyhost"] proxyport = effective_model["rhn.proxyport"] proxyuser = effective_model["rhn.proxyuser"] proxypassword = effective_model["rhn.proxypassword"] warning_text = "" if rhn_type == "sam" or rhn_type == "satellite": if url == "" or url is None: warning_text += "URL " if ca == "" or ca is None: if warning_text is "": warning_text += "CA path " else: warning_text += "and CA path " if warning_text is not "": txt = "%s must not be empty!" % warning_text self._error_dialog = ui.InfoDialog("dialog.error", "RHN Error", txt) return self._error_dialog else: model = rhn_model.RHN() # join proxy host/port self.logger.debug(proxyhost) self.logger.debug(proxyport) proxy = None if len(proxyhost) > 0 and len(proxyport) > 0: proxy = "%s:%s" % (proxyhost, proxyport) self.logger.debug(proxy) model.update(rhn_type, url, ca, user, profilename, activationkey, org, proxy, proxyuser) txs += model.transaction(password=pw, proxypass=proxypassword) progress_dialog = ui.TransactionProgressDialog( "dialog.txs", txs, self) progress_dialog.run() return self.ui_content()
def on_merge(self, effective_changes): self.logger.info("Saving network stuff") changes = Changeset(self.pending_changes(False)) effective_model = Changeset(self.model()) effective_model.update(effective_changes) self.logger.debug("Changes: %s" % changes) self.logger.info("Effective changes %s" % effective_changes) self.logger.debug("Effective Model: %s" % effective_model) # This object will contain all transaction elements to be executed txs = utils.Transaction("Network Interface Configuration") # Special case: A NIC was selected, display that dialog! if "nics" in changes and len(changes) == 1: iface = changes["nics"] self.logger.debug("Opening NIC Details dialog for '%s'" % iface) self._model_extra["dialog.nic.ifname"] = iface self._nic_dialog = NicDetailsDialog(self, iface) return self._nic_dialog if "dialog.nic.close" in changes: self._nic_dialog.close() return if "button.toggle_bond" in changes: m_bond = defaults.NicBonding() mnet = defaults.Network() if m_bond.retrieve()["slaves"]: if mnet.retrieve()["iface"] == m_bond.retrieve()["name"]: # Remove network config if primary devce was this # bond mnet.configure_no_networking() m_bond.configure_no_bond() txs += m_bond.transaction() txs += mnet.transaction() else: self._bond_dialog = CreateBondDialog("dialog.bond") self.widgets.add(self._bond_dialog) return self._bond_dialog if "button.ping" in changes: self.logger.debug("Opening ping page") self.application.switch_to_plugin(ping.Plugin) return if "dialog.nic.identify" in changes: ifname = self._model_extra["dialog.nic.ifname"] utils.network.NIC(ifname).identify() self.application.notice("Flashing lights now") return nameservers = [] dns_keys = ["dns[0]", "dns[1]"] if effective_changes.contains_any(dns_keys): nameservers += effective_model.values_for(dns_keys) if nameservers: self.logger.info("Setting new nameservers: %s" % nameservers) model = defaults.Nameservers() model.update(nameservers) txs += model.transaction() timeservers = [] ntp_keys = ["ntp[0]", "ntp[1]"] if effective_changes.contains_any(ntp_keys): timeservers += effective_model.values_for(ntp_keys) if timeservers: self.logger.info("Setting new timeservers: %s" % timeservers) model = defaults.Timeservers() model.update(timeservers) txs += model.transaction() hostname_keys = ["hostname"] if effective_changes.contains_any(hostname_keys): value = effective_model.values_for(hostname_keys) self.logger.info("Setting new hostname: %s" % value) model = defaults.Hostname() model.update(*value) txs += model.transaction() # For the NIC details dialog: if effective_changes.contains_any(self._nic_details_group): # If any networking related key was changed, reconfigure networking # Fetch the values for the nic keys, they are used as arguments args = effective_model.values_for(self._nic_details_group) txs += self._configure_nic(*args) if effective_changes.contains_any(self._bond_group): mb = defaults.NicBonding() mnet = defaults.Network() args = effective_model.values_for( ["bond.name", "bond.slaves.selected", "bond.options"]) self.logger.debug("args: %s" % args) mb.update(*args) txs += mb.transaction() txs += mnet.transaction() self._bond_dialog.close() progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self) progress_dialog.run() if "dialog.nic.save" in changes: # Close the remaing details dialog self._nic_dialog.close() # Behaves like a page reload return self.ui_content()