Esempio n. 1
0
    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()
Esempio n. 2
0
    def model(self):
        logrotate = defaults.Logrotate().retrieve()
        netconsole = defaults.Netconsole().retrieve()
        syslog = defaults.Syslog().retrieve()

        model = {}
        model["logrotate.max_size"] = logrotate["max_size"] or "1024"

        model["rsyslog.address"] = syslog["server"] or ""
        model["rsyslog.port"] = syslog["port"] or "514"

        model["netconsole.address"] = netconsole["server"] or ""
        model["netconsole.port"] = netconsole["port"] or "6666"

        return model
Esempio n. 3
0
def logrotate_auto():
    logroate_max_size = _functions.OVIRT_VARS["OVIRT_LOGROTATE_MAX_SIZE"]
    if logroate_max_size is not "":
        logger.info("Found! Using logrotate_max_size " + logroate_max_size)
        from ovirt.node.config import defaults
        try:
            model = defaults.Logrotate()
            model.update(max_size=logroate_max_size)
            tx = model.transaction()
            tx()
        except:
            pass
        return True
    else:
        logger.warn("Invalid logrotate max size: %s" % logroate_max_size)
        return False