Merge "Use executor section of zuul.conf for executor dirs" into feature/zuulv3
diff --git a/tests/base.py b/tests/base.py
index e605c87..e0aac3b 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -1882,12 +1882,16 @@
         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()
@@ -1904,8 +1908,10 @@
                             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
diff --git a/zuul/cmd/executor.py b/zuul/cmd/executor.py
index 44a7d3f..6a1a214 100755
--- a/zuul/cmd/executor.py
+++ b/zuul/cmd/executor.py
@@ -61,7 +61,7 @@
         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 @@
 
         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))
diff --git a/zuul/cmd/merger.py b/zuul/cmd/merger.py
index 97f208c..c5cfd6c 100755
--- a/zuul/cmd/merger.py
+++ b/zuul/cmd/merger.py
@@ -80,7 +80,7 @@
     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:
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index fe757b6..c5d292a 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -400,7 +400,7 @@
         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 @@
                               '%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 []