Exemplo n.º 1
0
 def translate_rsyslog(self):
     if self.__is_persisted("/etc/rsyslog.conf"):
         rsyslog_server, rsyslog_port = log.get_rsyslog_config() if \
             log.get_rsyslog_config() is not None else (None, 514)
         if rsyslog_server:
             self.aug.set("/files/etc/default/ovirt/OVIRT_SYSLOG_SERVER",
                          rsyslog_server or "")
             self.aug.set("/files/etc/default/ovirt/OVIRT_SYSLOG_PORT",
                          rsyslog_port or "")
Exemplo n.º 2
0
 def translate_rsyslog(self):
     if self.__is_persisted("/etc/rsyslog.conf"):
         rsyslog_server, rsyslog_port = log.get_rsyslog_config() if \
             log.get_rsyslog_config() is not None else (None, 514)
         if rsyslog_server:
             self.aug.set("/files/etc/default/ovirt/OVIRT_SYSLOG_SERVER",
                          rsyslog_server or "")
             self.aug.set("/files/etc/default/ovirt/OVIRT_SYSLOG_PORT",
                          rsyslog_port or "")
Exemplo n.º 3
0
def read_log_status():
    logging_status_text = ""
    if not get_rsyslog_config() is None:
        host, port = get_rsyslog_config()
        logging_status_text += "Rsyslog: %s:%s\n" % (host, port)
    netconsole_server = augtool_get("/files/etc/sysconfig/netconsole/" +
                                    "SYSLOGADDR")
    netconsole_server_port = augtool_get("/files/etc/sysconfig/" +
                                         "netconsole/SYSLOGPORT")
    if netconsole_server and netconsole_server_port:
        logging_status_text += "Netconsole: %s:%s" % (netconsole_server,
                                                      netconsole_server_port)
    if len(logging_status_text) == 0:
        logging_status_text = "Local Only"
    return logging_status_text
Exemplo n.º 4
0
 def get_layout(self):
     logging = WidgetBase('logging', 'Label', _('Logging'), title=True)
     log_max_size_label = WidgetBase('log_max_size_label', 'Label',
                                     _('Logrotate Max Log Size (KB):'))
     #because log_max_size_value has conf_path,
     #so set_conf will actually take two params(conf_path and value),
     #but, in fact, we only need one(value), conf_path is useless here.
     #so, using lambda to absorb conf_path, and only pass value to real
     #set_conf callback.
     log_max_size_value = WidgetBase(
         'log_max_size_value',
         ValidateEntry,
         get_conf=lambda v: datautil.augtool_get(v) or '1024',
         set_conf=lambda _, v: set_logrotate_size(v),
         conf_path=LOG_LOGRORATE_SIZE_PATH,
         params={'validator': datautil.validate_int})
     log_rsys = WidgetBase(
         'rsys',
         'Label',
         _('Rsyslog is an enhanced multi-threaded syslog'),
         title=True)
     log_server_address = WidgetBase('log_server_address', 'Label',
                                     _('Server Address:'))
     log_server_address_val = WidgetBase(
         'log_server_address',
         ValidateEntry,
         get_conf=lambda: get_rsyslog_config()[0]
         if get_rsyslog_config() else "",
         params={'validator': datautil.validate_ip})
     log_server_server_port = WidgetBase('log_server_port', 'Label',
                                         _('Server Port:'))
     log_server_server_port_val = WidgetBase(
         'log_server_port',
         ValidateEntry,
         get_conf=lambda: get_rsyslog_config()[1]
         if get_rsyslog_config() else "514",
         params={'validator': datautil.validate_port},
         set_conf=self.set_log_server)
     changes_log = WidgetBase('log_apply_reset', ApplyResetBtn)
     self.append([(logging, ), (log_max_size_label, log_max_size_value),
                  (log_rsys, ),
                  (log_server_address, log_server_address_val),
                  (
                      log_server_server_port,
                      log_server_server_port_val,
                  ), (WidgetBase('empty', 'Label', '', vhelp=140), ),
                  (changes_log, )])
     return self
Exemplo n.º 5
0
def read_log_status():
    logging_status_text = ""
    if not get_rsyslog_config() is None:
        host, port = get_rsyslog_config()
        logging_status_text += "Rsyslog: %s:%s\n" % (host, port)
    netconsole_server = augtool_get("/files/etc/sysconfig/netconsole/" +
                                    "SYSLOGADDR")
    netconsole_server_port = augtool_get("/files/etc/sysconfig/" +
                                         "netconsole/SYSLOGPORT")
    if netconsole_server and netconsole_server_port:
        logging_status_text += "Netconsole: %s:%s" % (
            netconsole_server,
            netconsole_server_port)
    if len(logging_status_text) == 0:
        logging_status_text = "Local Only"
    return logging_status_text
Exemplo n.º 6
0
 def get_layout(self):
     logging = WidgetBase(
         'logging', 'Label', _('Logging'), title=True)
     log_max_size_label = WidgetBase(
         'log_max_size_label', 'Label',
         _('Logrotate Max Log Size (KB):'))
     #because log_max_size_value has conf_path,
     #so set_conf will actually take two params(conf_path and value),
     #but, in fact, we only need one(value), conf_path is useless here.
     #so, using lambda to absorb conf_path, and only pass value to real
     #set_conf callback.
     log_max_size_value = WidgetBase(
         'log_max_size_value', ValidateEntry,
         get_conf=lambda v: datautil.augtool_get(v) or '1024',
         set_conf=lambda _, v: set_logrotate_size(v),
         conf_path=LOG_LOGRORATE_SIZE_PATH,
         params={'validator': datautil.validate_int})
     log_rsys = WidgetBase(
         'rsys', 'Label',
         _('Rsyslog is an enhanced multi-threaded syslog'), title=True)
     log_server_address = WidgetBase(
         'log_server_address', 'Label', _('Server Address:'))
     log_server_address_val = WidgetBase(
         'log_server_address', ValidateEntry,
         get_conf=lambda: get_rsyslog_config()[0] if
         get_rsyslog_config() else "",
         params={'validator': datautil.validate_ip})
     log_server_server_port = WidgetBase(
         'log_server_port', 'Label', _('Server Port:'))
     log_server_server_port_val = WidgetBase(
         'log_server_port', ValidateEntry,
         get_conf=lambda: get_rsyslog_config()[1] if
         get_rsyslog_config() else "514",
         params={'validator': datautil.validate_port},
         set_conf=self.set_log_server)
     changes_log = WidgetBase('log_apply_reset', ApplyResetBtn)
     self.append([
                 (logging,),
                 (log_max_size_label, log_max_size_value),
                 (log_rsys,),
                 (log_server_address, log_server_address_val),
                 (log_server_server_port, log_server_server_port_val,),
                 (WidgetBase('empty', 'Label', '', vhelp=140),),
                 (changes_log,)])
     return self