Adding a configuration option for gerritbots PID file path.
Closes-Bug: 1325583 Change-Id: I7200ae87963181e6ff8583ba665a141d7392605a
This commit is contained in:
parent
6208bd982f
commit
ed4e3d0b5c
|
@ -25,6 +25,7 @@ port=6667
|
||||||
force_ssl=false
|
force_ssl=false
|
||||||
server_password=SERVERPASS
|
server_password=SERVERPASS
|
||||||
channel_config=/path/to/yaml/config
|
channel_config=/path/to/yaml/config
|
||||||
|
pid=/path/to/pid_file
|
||||||
|
|
||||||
[gerrit]
|
[gerrit]
|
||||||
user=gerrit2
|
user=gerrit2
|
||||||
|
@ -296,10 +297,7 @@ class ChannelConfig(object):
|
||||||
self.branches[branch] = branch_set
|
self.branches[branch] = branch_set
|
||||||
|
|
||||||
|
|
||||||
def _main():
|
def _main(config):
|
||||||
config = ConfigParser.ConfigParser({'force_ssl': 'false',
|
|
||||||
'server_password': None})
|
|
||||||
config.read(sys.argv[1])
|
|
||||||
setup_logging(config)
|
setup_logging(config)
|
||||||
|
|
||||||
fp = config.get('ircbot', 'channel_config')
|
fp = config.get('ircbot', 'channel_config')
|
||||||
|
@ -334,10 +332,19 @@ def main():
|
||||||
print "Usage: %s CONFIGFILE" % sys.argv[0]
|
print "Usage: %s CONFIGFILE" % sys.argv[0]
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
pid = pid_file_module.TimeoutPIDLockFile(
|
config = ConfigParser.ConfigParser({'force_ssl': 'false',
|
||||||
"/var/run/gerritbot/gerritbot.pid", 10)
|
'server_password': None})
|
||||||
|
config.read(sys.argv[1])
|
||||||
|
|
||||||
|
pid_path = ""
|
||||||
|
if config.has_option('ircbot', 'pid'):
|
||||||
|
pid_path = config.get('ircbot', 'pid')
|
||||||
|
else:
|
||||||
|
pid_path = "/var/run/gerritbot/gerritbot.pid"
|
||||||
|
|
||||||
|
pid = pid_file_module.TimeoutPIDLockFile(pid_path, 10)
|
||||||
with daemon.DaemonContext(pidfile=pid):
|
with daemon.DaemonContext(pidfile=pid):
|
||||||
_main()
|
_main(config)
|
||||||
|
|
||||||
|
|
||||||
def setup_logging(config):
|
def setup_logging(config):
|
||||||
|
|
Loading…
Reference in New Issue