Parametrize Gearman client listening port and host

The Log Gearman Client got hardcoded value for listening host
and it also uses default Gear port (4730) for listening.
It would be helpful for some deployments to parametrize those
options.

Change-Id: I01f41468f66008bf8ee7902e9f7dd4b31abbbf45
This commit is contained in:
Daniel Pawlik 2021-12-03 10:56:48 +01:00
parent dae8dcc0b1
commit 3374873391
3 changed files with 9 additions and 2 deletions

View File

@ -10,6 +10,8 @@ container_images:
loggearman: quay.rdoproject.org/software-factory/loggearman:latest
# Gearman client
gearman_client_host: 0.0.0.0
gearman_client_port: 4730
source_url: ""
zmq_publishers: []
subunit_files: []
@ -17,7 +19,7 @@ source_files: []
# Gearman worker
gearman_host: 0.0.0.0
gearman_port: 4731
gearman_port: 4730
output_host: logstash.example.com
output_port: 9999
output_mode: tcp

View File

@ -1,4 +1,6 @@
---
gearman-host: {{ gearman_client_host }}
gearman-port: {{ gearman_client_port }}
source-url: {{ source_url }}
zmq-publishers: {{ zmq_publishers }}
subunit-files: {{ subunit_files }}

View File

@ -167,7 +167,9 @@ class Server(object):
def setup_processors(self):
for publisher in self.config['zmq-publishers']:
gearclient = gear.Client()
gearclient.addServer('localhost')
host = self.config.get('gearman-host', 'localhost')
port = self.config.get('gearman-port', 4730)
gearclient.addServer(host, port=port)
gearclient.waitForServer()
log_processor = EventProcessor(
publisher, gearclient,
@ -198,6 +200,7 @@ class Server(object):
if statsd_host:
self.wait_for_name_resolution(statsd_host, statsd_port)
self.gearserver = gear.Server(
port=self.config.get('gearman-port', 4730),
statsd_host=statsd_host,
statsd_port=statsd_port,
statsd_prefix=statsd_prefix)