Example #1
0
    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", "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"]
            if is_enabled and len(pw) == 0:
                txt = "Unable to configure CIM without a password!"
                self._confirm_dialog = ui.InfoDialog("dialog.confirm",
                                                     "CIM Error", txt)
                return self._confirm_dialog
            else:
                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()
        return self.ui_content()
Example #2
0
 def model(self):
     cfg = cim_model.CIM().retrieve()
     self.logger.debug(cfg)
     model = {
         "cim.enabled": True if cfg["enabled"] else False,
         "cim.password": "",
     }
     return model
Example #3
0
    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()