コード例 #1
0
    def _config_global_section():
        cfg = OrderedDict()

        statements = [
            "log %s local0" % RSYSLOG_DESTINATION,
            "log %s local1 notice" % RSYSLOG_DESTINATION, "log-send-hostname",
            "maxconn %s" % MAXCONN, "pidfile /var/run/haproxy.pid",
            "user %s" % HAPROXY_USER,
            "group %s" % HAPROXY_GROUP, "daemon",
            "stats socket /var/run/haproxy.stats level admin"
        ]

        if NBPROC > 1:
            statements.append("nbproc %s" % NBPROC)
            statements.append("stats bind-process %s" % NBPROC)
            for x in range(1, NBPROC + 1):
                statements.append("cpu-map %s %s" % (x, x - 1))

        statements.extend(
            ConfigHelper.config_ssl_bind_options(SSL_BIND_OPTIONS))
        statements.extend(
            ConfigHelper.config_ssl_bind_ciphers(SSL_BIND_CIPHERS))
        statements.extend(
            ConfigHelper.config_extra_settings(EXTRA_GLOBAL_SETTINGS))
        cfg["global"] = statements
        return cfg
コード例 #2
0
    def _config_global_section():
        cfg = OrderedDict()

        statements = ["log %s local0 err" % RSYSLOG_DESTINATION,
                      "log %s local1 err" % RSYSLOG_DESTINATION,
                      "log-send-hostname",
                      "maxconn %s" % MAXCONN,
                      "pidfile /var/run/haproxy.pid",
                      "user %s" % HAPROXY_USER,
                      "group %s" % HAPROXY_GROUP,
                      "daemon",
                      "stats socket /var/run/haproxy.stats level admin"]

        if NBPROC > 1:
            statements.append("nbproc %s" % NBPROC)
            statements.append("stats bind-process %s" % NBPROC)
            for x in range(1, NBPROC + 1):
                statements.append("cpu-map %s %s" % (x, x - 1))

        statements.extend(ConfigHelper.config_ssl_bind_options(SSL_BIND_OPTIONS))
        statements.extend(ConfigHelper.config_ssl_bind_ciphers(SSL_BIND_CIPHERS))
        statements.extend(ConfigHelper.config_extra_settings(EXTRA_GLOBAL_SETTINGS))
        if EXTRA_GLOBAL_SETTINGS_FILE:
            try:
                with open(EXTRA_GLOBAL_SETTINGS_FILE) as file:
                    for line in file:
                        statements.append(line.strip())
            except Exception as e:
                logger.info(
                    "Error reading EXTRA_GLOBAL_SETTINGS_FILE at '%s', error %s" % (EXTRA_GLOBAL_SETTINGS_FILE, e))
        cfg["global"] = statements

        return cfg
コード例 #3
0
    def _config_global_section():
        cfg = OrderedDict()

        statements = ["log %s local0" % RSYSLOG_DESTINATION,
                      "log %s local1 notice" % RSYSLOG_DESTINATION,
                      "log-send-hostname",
                      "maxconn %s" % MAXCONN,
                      "pidfile /var/run/haproxy.pid",
                      "user haproxy",
                      "group haproxy",
                      "daemon",
                      "stats socket /var/run/haproxy.stats level admin"]
        if not SSL_BIND_OPTIONS:
            statements.extend(ConfigHelper.config_ssl_bind_options(SSL_BIND_OPTIONS))
        statements.extend(ConfigHelper.config_ssl_bind_ciphers(SSL_BIND_CIPHERS))
        statements.extend(ConfigHelper.config_extra_settings(EXTRA_GLOBAL_SETTINGS))
        cfg["global"] = statements
        return cfg
コード例 #4
0
    def _config_global_section():
        cfg = OrderedDict()

        statements = ["log %s local0" % RSYSLOG_DESTINATION,
                      "log %s local1 notice" % RSYSLOG_DESTINATION,
                      "log-send-hostname",
                      "maxconn %s" % MAXCONN,
                      "pidfile /var/run/haproxy.pid",
                      "user haproxy",
                      "group haproxy",
                      "daemon",
                      "stats socket /var/run/haproxy.stats level admin"]

        statements.extend(ConfigHelper.config_ssl_bind_options(SSL_BIND_OPTIONS))
        statements.extend(ConfigHelper.config_ssl_bind_ciphers(SSL_BIND_CIPHERS))
        statements.extend(ConfigHelper.config_extra_settings(EXTRA_GLOBAL_SETTINGS))
        cfg["global"] = statements
        return cfg