Пример #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()
Пример #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
Пример #3
0
    def _logging_summary(self):
        """Return a textual summary of the current log configuration
        """
        netconsole = defaults.Netconsole().retrieve()
        syslog = defaults.Syslog().retrieve()

        destinations = []

        if syslog["server"]:
            destinations.append("Rsyslog: %s:%s" %
                                (syslog["server"], syslog["port"] or "514"))

        if netconsole["server"]:
            destinations.append(
                "Netconsole: %s:%s" %
                (netconsole["server"], netconsole["port"] or "6666"))

        return ", ".join(destinations) if destinations else "Local Only"
Пример #4
0
    def _logging_summary(self):
        """Return a textual summary of the current log configuration
        """
        netconsole = defaults.Netconsole().retrieve()
        syslog = defaults.Syslog().retrieve()

        destinations = []

        if syslog["server"]:
            destinations.append(
                "Rsyslog: %s:%s" %
                (IPAddress(syslog["server"]), syslog["port"] or "514"))

        if netconsole["server"]:
            destinations.append("Netconsole: %s:%s" % (IPAddress(
                netconsole["server"]), netconsole["port"] or "6666"))

        indented = "\n" + " ".ljust(13)
        return indented.join(destinations) if destinations else "Local Only"