Add command_socket setting to executor section
Like the merger, add support for setting command_socket path via zuul.conf. Change-Id: I88aa47870d98b0906dfb733f68af663c2dc00993 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
765061143d
commit
2092091541
|
@ -397,6 +397,11 @@ The following sections of ``zuul.conf`` are used by the executor:
|
||||||
|
|
||||||
.. attr:: executor
|
.. attr:: executor
|
||||||
|
|
||||||
|
.. attr:: command_socket
|
||||||
|
:default: /var/lib/zuul/executor.socket
|
||||||
|
|
||||||
|
Path to command socket file for the executor process.
|
||||||
|
|
||||||
.. attr:: finger_port
|
.. attr:: finger_port
|
||||||
:default: 79
|
:default: 79
|
||||||
|
|
||||||
|
|
|
@ -2070,6 +2070,9 @@ class ZuulTestCase(BaseTestCase):
|
||||||
self.config.set('executor', 'git_dir', self.executor_src_root)
|
self.config.set('executor', 'git_dir', self.executor_src_root)
|
||||||
self.config.set('executor', 'private_key_file', self.private_key_file)
|
self.config.set('executor', 'private_key_file', self.private_key_file)
|
||||||
self.config.set('executor', 'state_dir', self.executor_state_root)
|
self.config.set('executor', 'state_dir', self.executor_state_root)
|
||||||
|
self.config.set(
|
||||||
|
'executor', 'command_socket',
|
||||||
|
os.path.join(self.test_root, 'executor.socket'))
|
||||||
|
|
||||||
self.statsd = FakeStatsd()
|
self.statsd = FakeStatsd()
|
||||||
if self.config.has_section('statsd'):
|
if self.config.has_section('statsd'):
|
||||||
|
|
|
@ -53,11 +53,11 @@ class Executor(zuul.cmd.ZuulDaemonApp):
|
||||||
self.args.nodaemon = True
|
self.args.nodaemon = True
|
||||||
|
|
||||||
def send_command(self, cmd):
|
def send_command(self, cmd):
|
||||||
state_dir = get_default(self.config, 'executor', 'state_dir',
|
command_socket = get_default(
|
||||||
'/var/lib/zuul', expand_user=True)
|
self.config, 'executor', 'command_socket',
|
||||||
path = os.path.join(state_dir, 'executor.socket')
|
'/var/lib/zuul/executor.socket')
|
||||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
s.connect(path)
|
s.connect(command_socket)
|
||||||
cmd = '%s\n' % cmd
|
cmd = '%s\n' % cmd
|
||||||
s.sendall(cmd.encode('utf8'))
|
s.sendall(cmd.encode('utf8'))
|
||||||
|
|
||||||
|
|
|
@ -1608,10 +1608,13 @@ class ExecutorServer(object):
|
||||||
self.merger = self._getMerger(self.merge_root)
|
self.merger = self._getMerger(self.merge_root)
|
||||||
self.update_queue = DeduplicateQueue()
|
self.update_queue = DeduplicateQueue()
|
||||||
|
|
||||||
|
command_socket = get_default(
|
||||||
|
self.config, 'executor', 'command_socket',
|
||||||
|
'/var/lib/zuul/executor.socket')
|
||||||
|
self.command_socket = commandsocket.CommandSocket(command_socket)
|
||||||
|
|
||||||
state_dir = get_default(self.config, 'executor', 'state_dir',
|
state_dir = get_default(self.config, 'executor', 'state_dir',
|
||||||
'/var/lib/zuul', expand_user=True)
|
'/var/lib/zuul', expand_user=True)
|
||||||
path = os.path.join(state_dir, 'executor.socket')
|
|
||||||
self.command_socket = commandsocket.CommandSocket(path)
|
|
||||||
ansible_dir = os.path.join(state_dir, 'ansible')
|
ansible_dir = os.path.join(state_dir, 'ansible')
|
||||||
self.ansible_dir = ansible_dir
|
self.ansible_dir = ansible_dir
|
||||||
if os.path.exists(ansible_dir):
|
if os.path.exists(ansible_dir):
|
||||||
|
|
Loading…
Reference in New Issue