d291e7f1e7
It is off by default (keepalive=0), which means connections may hang forever when media is not reliable. This change applies the same change as proposed for Zuul: https://review.openstack.org/238988 Support in puppets going with dependent review Change-Id: Ifaf6aa28ad65305592839c1bd2ca90157a32ab3c
52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
|
|
import ConfigParser
|
|
|
|
CONFIG_FILE = '/etc/ci-scoreboard/ci-scoreboard.conf'
|
|
CONFIG_SECTION = 'scoreboard'
|
|
|
|
|
|
class Config:
|
|
def __init__(self):
|
|
self._cfg = ConfigParser.ConfigParser()
|
|
self._cfg.read(CONFIG_FILE)
|
|
|
|
def _value(self, option):
|
|
if self._cfg.has_option(CONFIG_SECTION, option):
|
|
return self._cfg.get(CONFIG_SECTION, option)
|
|
return None
|
|
|
|
def _int_value(self, option):
|
|
if self._cfg.has_option(CONFIG_SECTION, option):
|
|
return self._cfg.getint(CONFIG_SECTION, option)
|
|
return None
|
|
|
|
def _float_value(self, option):
|
|
if self._cfg.has_option(CONFIG_SECTION, option):
|
|
return self._cfg.getfloat(CONFIG_SECTION, option)
|
|
return None
|
|
|
|
def gerrit_user(self):
|
|
return self._value('GERRIT_USER')
|
|
|
|
def gerrit_key(self):
|
|
return self._value('GERRIT_KEY')
|
|
|
|
def gerrit_hostname(self):
|
|
return self._value('GERRIT_HOSTNAME')
|
|
|
|
def gerrit_port(self):
|
|
return self._int_value('GERRIT_PORT')
|
|
|
|
def gerrit_keepalive(self):
|
|
keepalive = self._int_value('GERRIT_KEEPALIVE')
|
|
# 0 is the safe default, meaning no keepalives
|
|
if keepalive is None:
|
|
keepalive = 0
|
|
return keepalive
|
|
|
|
def db_uri(self):
|
|
return self._value('DB_URI')
|
|
|
|
def log_file(self):
|
|
return self._value('LOG_FILE_LOCATION')
|