[WORKER] Allow haproxy logfile path to be configurable
Change-Id: Ia7569106226022b8901038bc2444fc5e1e9f91c1
This commit is contained in:
@@ -63,6 +63,10 @@ Command Line Options
|
||||
Full path to the file with the SSL private key to use when
|
||||
connecting to an SSL-enabled Gearman job server.
|
||||
|
||||
.. option:: --haproxy_logfile <FILE>
|
||||
|
||||
Configure the path for where to put haproxy log.
|
||||
|
||||
.. option:: -s <SECONDS>, --reconnect_sleep <SECONDS>
|
||||
|
||||
The number of seconds to sleep between job server reconnect attempts
|
||||
|
||||
@@ -32,6 +32,7 @@ gearman_poll = 60
|
||||
server = 10.0.0.1:4730 10.0.0.2:4730
|
||||
pid = /var/run/libra/libra_worker.pid
|
||||
logfile = /var/log/libra/libra_worker.log
|
||||
haproxy_logfile = /var/log/haproxy.log
|
||||
|
||||
# The [mgm] section is specific to the libra_mgm utility.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class TestWorkerController(testtools.TestCase):
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
self.logger.addHandler(self.lh)
|
||||
self.driver = HAProxyDriver('libra.tests.mock_objects.FakeOSServices',
|
||||
None, None)
|
||||
None, None, None)
|
||||
|
||||
def testBadAction(self):
|
||||
msg = {
|
||||
|
||||
@@ -26,8 +26,8 @@ from libra.worker.drivers.haproxy.services_base import ServicesBase
|
||||
|
||||
class HAProxyDriver(LoadBalancerDriver):
|
||||
|
||||
def __init__(self, ossvc, user, group):
|
||||
self.haproxy_log = '/mnt/log/haproxy.log'
|
||||
def __init__(self, ossvc, user, group, haproxy_logfile=None):
|
||||
self.haproxy_log = haproxy_logfile
|
||||
self.user = user
|
||||
self.group = group
|
||||
ossvc_driver = importutils.import_class(ossvc)
|
||||
|
||||
@@ -109,6 +109,11 @@ def main():
|
||||
choices=haproxy_services.keys(), default='ubuntu',
|
||||
help='os services to use with HAProxy driver (when used)'
|
||||
)
|
||||
options.parser.add_argument(
|
||||
'--haproxy_logfile', type=str,
|
||||
default='/var/log/haproxy.log',
|
||||
help="Where to store the HAProxy logfile"
|
||||
)
|
||||
options.parser.add_argument(
|
||||
'-s', '--reconnect_sleep', type=int, metavar='TIME',
|
||||
default=60, help='seconds to sleep between job server reconnects'
|
||||
@@ -126,6 +131,7 @@ def main():
|
||||
'--gearman_poll', type=int, metavar='TIME',
|
||||
default=1, help='Gearman worker polling timeout'
|
||||
)
|
||||
|
||||
args = options.run()
|
||||
|
||||
if not args.server:
|
||||
@@ -157,7 +163,8 @@ def main():
|
||||
group = None
|
||||
|
||||
driver = driver_class(haproxy_services[args.haproxy_service],
|
||||
user, group)
|
||||
user, group,
|
||||
haproxy_logfile=args.haproxy_logfile)
|
||||
else:
|
||||
driver = driver_class()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user