Make finger port configurable

In some setups (e.g. unprivileged container) it is not allowed to bind
to privileged ports. In order to still being able to use the log
streamer the finger port must be configurable. In case of a docker
container the port could be mapped to the default port outside then.

Change-Id: I996b4740876a71d99cc4d22dda6beda5b9b2f028
This commit is contained in:
Tobias Henkel 2017-06-02 12:27:47 +02:00
parent 0e7a1c8326
commit cec29669d3
2 changed files with 11 additions and 2 deletions

View File

@ -174,6 +174,10 @@ executor
The zuul-executor process configuration.
**finger_port**
Port to use for finger log streamer.
``finger_port=79``
**git_dir**
Directory that Zuul should clone local git repositories to.
``git_dir=/var/lib/zuul/git``

View File

@ -39,7 +39,7 @@ import zuul.executor.server
# Similar situation with gear and statsd.
FINGER_PORT = 79
DEFAULT_FINGER_PORT = 79
class Executor(zuul.cmd.ZuulApp):
@ -86,7 +86,7 @@ class Executor(zuul.cmd.ZuulApp):
self.log.info("Starting log streamer")
streamer = zuul.lib.log_streamer.LogStreamer(
self.user, '0.0.0.0', FINGER_PORT, self.jobroot_dir)
self.user, '0.0.0.0', self.finger_port, self.jobroot_dir)
# Keep running until the parent dies:
pipe_read = os.fdopen(pipe_read)
@ -127,6 +127,11 @@ class Executor(zuul.cmd.ZuulApp):
self.setup_logging('executor', 'log_config')
self.log = logging.getLogger("zuul.Executor")
if self.config.has_option('executor', 'finger_port'):
self.finger_port = int(self.config.get('executor', 'finger_port'))
else:
self.finger_port = DEFAULT_FINGER_PORT
self.start_log_streamer()
self.change_privs()