Use executor section of zuul.conf for executor dirs

And the same for merger.

Change-Id: Ifeb933d9b1ecb7899f63945d73561cfda7f0375c
This commit is contained in:
James E. Blair 2017-06-23 20:47:51 +01:00
parent edc4016b4b
commit 01d733e95f
4 changed files with 12 additions and 6 deletions

View File

@ -1846,12 +1846,16 @@ class ZuulTestCase(BaseTestCase):
self.merger_src_root = os.path.join(self.test_root, "merger-git")
self.executor_src_root = os.path.join(self.test_root, "executor-git")
self.state_root = os.path.join(self.test_root, "lib")
self.merger_state_root = os.path.join(self.test_root, "merger-lib")
self.executor_state_root = os.path.join(self.test_root, "executor-lib")
if os.path.exists(self.test_root):
shutil.rmtree(self.test_root)
os.makedirs(self.test_root)
os.makedirs(self.upstream_root)
os.makedirs(self.state_root)
os.makedirs(self.merger_state_root)
os.makedirs(self.executor_state_root)
# Make per test copy of Configuration.
self.setup_config()
@ -1868,8 +1872,10 @@ class ZuulTestCase(BaseTestCase):
self.config.get('scheduler', 'tenant_config')))
self.config.set('zuul', 'state_dir', self.state_root)
self.config.set('merger', 'git_dir', self.merger_src_root)
self.config.set('merger', 'state_dir', self.merger_state_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', 'state_dir', self.executor_state_root)
self.statsd = FakeStatsd()
# note, use 127.0.0.1 rather than localhost to avoid getting ipv6

View File

@ -61,7 +61,7 @@ class Executor(zuul.cmd.ZuulApp):
self.args = parser.parse_args()
def send_command(self, cmd):
state_dir = get_default(self.config, 'zuul', 'state_dir',
state_dir = get_default(self.config, 'executor', 'state_dir',
'/var/lib/zuul', expand_user=True)
path = os.path.join(state_dir, 'executor.socket')
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
@ -111,9 +111,9 @@ class Executor(zuul.cmd.ZuulApp):
self.user = get_default(self.config, 'executor', 'user', 'zuul')
if self.config.has_option('zuul', 'jobroot_dir'):
if self.config.has_option('executor', 'jobroot_dir'):
self.jobroot_dir = os.path.expanduser(
self.config.get('zuul', 'jobroot_dir'))
self.config.get('executor', 'jobroot_dir'))
if not os.path.isdir(self.jobroot_dir):
print("Invalid jobroot_dir: {jobroot_dir}".format(
jobroot_dir=self.jobroot_dir))

View File

@ -80,7 +80,7 @@ def main():
server.read_config()
server.configure_connections(source_only=True)
state_dir = get_default(server.config, 'zuul', 'state_dir',
state_dir = get_default(server.config, 'merger', 'state_dir',
'/var/lib/zuul', expand_user=True)
test_fn = os.path.join(state_dir, 'test')
try:

View File

@ -400,7 +400,7 @@ class ExecutorServer(object):
self.merger = self._getMerger(self.merge_root)
self.update_queue = DeduplicateQueue()
state_dir = get_default(self.config, 'zuul', 'state_dir',
state_dir = get_default(self.config, 'executor', 'state_dir',
'/var/lib/zuul', expand_user=True)
path = os.path.join(state_dir, 'executor.socket')
self.command_socket = commandsocket.CommandSocket(path)
@ -1293,7 +1293,7 @@ class AnsibleJob(object):
'%s_ro_dirs' % opt_prefix)
rw_dirs = get_default(self.executor_server.config, 'executor',
'%s_rw_dirs' % opt_prefix)
state_dir = get_default(self.executor_server.config, 'zuul',
state_dir = get_default(self.executor_server.config, 'executor',
'state_dir', '/var/lib/zuul', expand_user=True)
ro_dirs = ro_dirs.split(":") if ro_dirs else []
rw_dirs = rw_dirs.split(":") if rw_dirs else []