當前位置: 首頁>>代碼示例>>Python>>正文


Python Changeset.values_for方法代碼示例

本文整理匯總了Python中ovirt.node.plugins.Changeset.values_for方法的典型用法代碼示例。如果您正苦於以下問題:Python Changeset.values_for方法的具體用法?Python Changeset.values_for怎麽用?Python Changeset.values_for使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ovirt.node.plugins.Changeset的用法示例。


在下文中一共展示了Changeset.values_for方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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"]
        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()
開發者ID:GregSutcliffe,項目名稱:ovirt-node,代碼行數:36,代碼來源:logging_page.py

示例2: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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()

        scsi_keys = ["scsi.dh_alua"]
        if changes.contains_any(scsi_keys):
            model = defaults.SCSIDhAlua()
            args = effective_model.values_for(scsi_keys)
            model.update(*args)
            txs += model.transaction()

        progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self)
        progress_dialog.run()
開發者ID:Zealsathish,項目名稱:ovirt-node,代碼行數:37,代碼來源:remote_storage_page.py

示例3: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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()
開發者ID:lzap,項目名稱:ovirt-node,代碼行數:28,代碼來源:puppet_page.py

示例4: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    def on_merge(self, effective_changes):
        """Applies the changes to the plugins model, will do all required logic
        Normally on_merge is called by pushing the SaveButton instance, in this
        case it is called by on_change
        """
        self.logger.debug("Saving kdump page")
        changes = Changeset(self.pending_changes(False))
        effective_model = Changeset(self.model())
        saved_model = self.model()
        effective_model.update(effective_changes)

        self.logger.debug("Changes: %s" % changes)
        self.logger.debug("Effective Model: %s" % effective_model)

        kdump_keys = ["kdump.type", "kdump.ssh_location", "kdump.ssh_key",
                      "kdump.nfs_location"]

        txs = utils.Transaction(_("Updating kdump related configuration"))

        if changes.contains_any(kdump_keys):
            model = defaults.KDump()
            ktype, sshloc, sshkey, nfsloc = effective_model.values_for(
                kdump_keys)
            if ktype == "nfs":
                model.configure_nfs(nfsloc)
            elif ktype == "ssh":
                if "kdump.ssh_key" in changes:
                    model.configure_ssh(sshloc, sshkey)
                else:
                    model.configure_ssh(sshloc)
            elif ktype == "local":
                model.configure_local()
            else:
                model.configure_disable()
            txs += model.transaction()

        try:
            with self.application.ui.suspended():
                console.reset()
                is_dry = self.application.args.dry
                progress_dialog = console.TransactionProgress(txs, is_dry)
                progress_dialog.run()
                console.writeln("\nPlease press any key to continue")
                console.wait_for_keypress()
        except KeyboardInterrupt:
            def _handler(signum, frame):
                console.writeln("\nWait for configuration to be restored\n")
            with self.application.ui.suspended():
                _original_sigint = signal.getsignal(signal.SIGINT)
                signal.signal(signal.SIGINT, _handler)
                self.restore_config(saved_model)
                signal.signal(signal.SIGINT, _original_sigint)
                return InfoDialog("dialog.restore", "Restored the "
                                  "configuration on keyboard interrupt")
        except Exception as e:
            self.restore_config(saved_model)
            self.logger.exception("Exception while configuring kdump")
            self.application.show(self.ui_content())
            return InfoDialog("dialog.info", "An error occurred", e.message)
        return self.ui_content()
開發者ID:gvsurenderreddy,項目名稱:ovirt-node,代碼行數:62,代碼來源:kdump_page.py

示例5: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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"]

        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.admin.password"]):
            pw = effective_model["passwd.admin.password"]
            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()
開發者ID:oVirt,項目名稱:Node,代碼行數:37,代碼來源:security_page.py

示例6: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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("make local storage path")

        iscsi_keys = ["iscsi.initiator_name"]
        if changes.contains_any(iscsi_keys):
            
            args = effective_model.values_for(iscsi_keys)
            #model = defaults.iSCSI()
            txs += [createPath(args[0])]
            #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()
開發者ID:aiminickwong,項目名稱:ovirt_config,代碼行數:32,代碼來源:remote_storage_page.py

示例7: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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("Add engine to Windows AD")

        if changes.contains_any(collectd_keys):
            model = defaults.Collectd()
            model.update(*effective_model.values_for(collectd_keys))
            args = effective_model.values_for(collectd_keys)
            txs += [AD(args[0],args[1])]
            txs += model.transaction()

        progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self)
        progress_dialog.run()
開發者ID:aiminickwong,項目名稱:ovirt_config,代碼行數:24,代碼來源:monitoring_page.py

示例8: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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()
開發者ID:aiminickwong,項目名稱:ovirt_config,代碼行數:24,代碼來源:hostname_page.py

示例9: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    def on_merge(self, effective_changes):
        """Applies the changes to the plugins model, will do all required logic
        Normally on_merge is called by pushing the SaveButton instance, in this
        case it is called by on_change
        """
        self.logger.debug("Saving kdump 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)

        kdump_keys = ["kdump.type", "kdump.ssh_location", "kdump.ssh_key",
                      "kdump.nfs_location"]

        txs = utils.Transaction(_("Updating kdump related configuration"))

        if changes.contains_any(kdump_keys):
            model = defaults.KDump()
            ktype, sshloc, sshkey, nfsloc = effective_model.values_for(
                kdump_keys)
            if ktype == "nfs":
                model.update(nfsloc, None, None, None)
            elif ktype == "ssh":
                if "kdump.ssh_key" in changes:
                    model.update(None, sshloc, sshkey, None)
                else:
                    model.update(None, sshloc, None, None)
            elif ktype == "local":
                model.update(None, None, None, True)
            else:
                model.update(None, None, None, None)
            txs += model.transaction()

        try:
            with self.application.ui.suspended():
                console.reset()
                is_dry = self.application.args.dry
                progress_dialog = console.TransactionProgress(txs, is_dry)
                progress_dialog.run()
                console.writeln("\nPlease press any key to continue")
                console.wait_for_keypress()
        except Exception as e:
            self.logger.exception("Exception while configuring kdump")
            return InfoDialog("dialog.info", _("An error occurred"), e.message)
開發者ID:GregSutcliffe,項目名稱:ovirt-node,代碼行數:48,代碼來源:kdump_page.py

示例10: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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()
開發者ID:ArchipelProject,項目名稱:Node,代碼行數:22,代碼來源:keyboard_page.py

示例11: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    def on_merge(self, effective_changes):
        """Applies the changes to the plugins model, will do all required logic
        Normally on_merge is called by pushing the SaveButton instance, in this
        case it is called by on_change
        """
        self.logger.debug("Saving kdump 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)

        kdump_keys = ["kdump.type", "kdump.ssh_location", "kdump.nfs_location"]

        txs = utils.Transaction("Updating kdump related configuration")

        if changes.contains_any(kdump_keys):
            model = defaults.KDump()
            ktype, sshloc, nfsloc = effective_model.values_for(kdump_keys)
            if ktype == "nfs":
                model.update(nfsloc, None, None)
            elif ktype == "ssh":
                model.update(None, sshloc, None)
            elif ktype == "local":
                model.update(None, None, True)
            else:
                model.update(None, None, None)
            txs += model.transaction()

        with self.application.ui.suspended():
            utils.process.call("reset")
            progress_dialog = console.TransactionProgress(txs, self)
            progress_dialog.run()
            console.writeln("\nPlease press any key to continue")
            console.wait_for_keypress()
開發者ID:ArchipelProject,項目名稱:Node,代碼行數:38,代碼來源:kdump_page.py

示例12: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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()
開發者ID:ianjw11,項目名稱:ovirt-node,代碼行數:26,代碼來源:snmp_page.py

示例13: Changeset

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
if __name__ == "__main__":
    rhn = rhn_model.RHN()
    cfg = rhn.retrieve()
    rhn_password = _functions.OVIRT_VARS["OVIRT_RHN_PASSWORD"] \
                   if "OVIRT_RHN_PASSWORD" in _functions.OVIRT_VARS else ""
    rhn_proxypassword = _functions.OVIRT_VARS["OVIRT_RHN_PROXYPASSWORD"] \
                        if "OVIRT_RHN_PROXYPASSWORD" in _functions.OVIRT_VARS \
                        else ""
    effective_model = Changeset({
        "rhn.rhntype": cfg['rhntype'],
        "rhn.url": cfg['url'],
        "rhn.ca_cert": cfg['ca_cert'],
        "rhn.username": cfg['username'],
        "rhn.profile": cfg['profile'],
        "rhn.activationkey": cfg['activationkey'],
        "rhn.org": cfg['org'],
        "rhn.proxy": cfg['proxy'],
        "rhn.proxyuser": cfg['proxyuser'],
    })
    effective_model.update(changes)
    rhn.update(*effective_model.values_for(
        [keys_to_model[key] for key in keys]))
    if cfg['username'] and rhn_password or cfg['activationkey']:
        tx = rhn.transaction(password=rhn_password, \
                             proxypass=rhn_proxypassword)
        TransactionProgress(tx, is_dry=False).run()
        # remove /etc/default/ovirt entries from being persisted
        pw_keys = ("OVIRT_RHN_PASSWORD", "OVIRT_RHN_PROXYPASSWORD")
        rhn.clear(keys=pw_keys)
開發者ID:gordongong,項目名稱:ovirt-node,代碼行數:31,代碼來源:rhn_autoinstall.py

示例14: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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()
開發者ID:ArchipelProject,項目名稱:Node,代碼行數:78,代碼來源:network_page.py

示例15: on_merge

# 需要導入模塊: from ovirt.node.plugins import Changeset [as 別名]
# 或者: from ovirt.node.plugins.Changeset import values_for [as 別名]
    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()
開發者ID:oVirt,項目名稱:ovirt-node,代碼行數:90,代碼來源:rhn_page.py


注:本文中的ovirt.node.plugins.Changeset.values_for方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。