Handle log paths in logstash gearman client better

* modules/openstack_project/files/logstash/log-gearman-client.py:
Use os.path.join to join the base log path provided by Jenkins and the
log file provided in the gearman client config. This avoid needing to
worry about trailing slashes in the Jenkins provided path.

Change-Id: I973237dae6f0b7947d322489108a05a99a7cc0be
This commit is contained in:
Clark Boylan 2013-07-31 15:32:54 -07:00
parent fb99b4fa74
commit 1678360e3b

View File

@ -19,6 +19,7 @@ import daemon
import gear import gear
import json import json
import logging import logging
import os
import signal import signal
import threading import threading
import yaml import yaml
@ -101,7 +102,7 @@ class EventProcessor(threading.Thread):
fields = self._parse_fields(event, fileopts['name']) fields = self._parse_fields(event, fileopts['name'])
log_dir = self._get_log_dir(event) log_dir = self._get_log_dir(event)
source_url = fileopts.get('source-url', self.source_url) + '/' + \ source_url = fileopts.get('source-url', self.source_url) + '/' + \
log_dir + fileopts['name'] os.path.join(log_dir, fileopts['name'])
out_event = {} out_event = {}
out_event["@fields"] = fields out_event["@fields"] = fields
out_event["@tags"] = [fileopts['name']] + fileopts.get('tags', []) out_event["@tags"] = [fileopts['name']] + fileopts.get('tags', [])