Merge "Move tenant_config option to scheduler section" into feature/zuulv3
diff --git a/doc/source/admin/quick-start.rst b/doc/source/admin/quick-start.rst
index 780496b..9993775 100644
--- a/doc/source/admin/quick-start.rst
+++ b/doc/source/admin/quick-start.rst
@@ -54,7 +54,7 @@
 
 **zuul.conf**::
 
-    [zuul]
+    [scheduler]
     tenant_config=/etc/zuul/main.yaml
 
     [gearman_server]
diff --git a/tests/base.py b/tests/base.py
index 6393446..e605c87 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -1898,12 +1898,13 @@
             shutil.copy('{}.pub'.format(src_private_key_file),
                         '{}.pub'.format(self.private_key_file))
             os.chmod(self.private_key_file, 0o0600)
-        self.config.set('zuul', 'tenant_config',
-                        os.path.join(FIXTURE_DIR,
-                                     self.config.get('zuul', 'tenant_config')))
+        self.config.set('scheduler', 'tenant_config',
+                        os.path.join(
+                            FIXTURE_DIR,
+                            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('executor', 'git_dir', self.executor_src_root)
-        self.config.set('zuul', 'state_dir', self.state_root)
         self.config.set('executor', 'private_key_file', self.private_key_file)
 
         self.statsd = FakeStatsd()
@@ -2045,9 +2046,14 @@
         self.config = configparser.ConfigParser()
         self.config.read(os.path.join(FIXTURE_DIR, self.config_file))
 
+        sections = ['zuul', 'scheduler', 'executor', 'merger']
+        for section in sections:
+            if not self.config.has_section(section):
+                self.config.add_section(section)
+
         if not self.setupSimpleLayout():
             if hasattr(self, 'tenant_config_file'):
-                self.config.set('zuul', 'tenant_config',
+                self.config.set('scheduler', 'tenant_config',
                                 self.tenant_config_file)
                 git_path = os.path.join(
                     os.path.dirname(
@@ -2105,7 +2111,7 @@
                                 'untrusted-projects': untrusted_projects}}}}]
         f.write(yaml.dump(config).encode('utf8'))
         f.close()
-        self.config.set('zuul', 'tenant_config',
+        self.config.set('scheduler', 'tenant_config',
                         os.path.join(FIXTURE_DIR, f.name))
 
         self.init_repo('common-config')
@@ -2118,7 +2124,7 @@
         if self.create_project_keys:
             return
 
-        path = self.config.get('zuul', 'tenant_config')
+        path = self.config.get('scheduler', 'tenant_config')
         with open(os.path.join(FIXTURE_DIR, path)) as f:
             tenant_config = yaml.safe_load(f.read())
         for tenant in tenant_config:
@@ -2627,7 +2633,7 @@
           - org/project1
           - org/project2\n""" % path)
         f.close()
-        self.config.set('zuul', 'tenant_config',
+        self.config.set('scheduler', 'tenant_config',
                         os.path.join(FIXTURE_DIR, f.name))
         self.setupAllProjectKeys()
 
diff --git a/tests/fixtures/zuul-connections-gerrit-and-github.conf b/tests/fixtures/zuul-connections-gerrit-and-github.conf
index 69e7f8b..64757d8 100644
--- a/tests/fixtures/zuul-connections-gerrit-and-github.conf
+++ b/tests/fixtures/zuul-connections-gerrit-and-github.conf
@@ -1,7 +1,7 @@
 [gearman]
 server=127.0.0.1
 
-[zuul]
+[scheduler]
 tenant_config=config/multi-driver/main.yaml
 
 [merger]
diff --git a/tests/fixtures/zuul-connections-multiple-gerrits.conf b/tests/fixtures/zuul-connections-multiple-gerrits.conf
index 43b00ef..66a6926 100644
--- a/tests/fixtures/zuul-connections-multiple-gerrits.conf
+++ b/tests/fixtures/zuul-connections-multiple-gerrits.conf
@@ -1,7 +1,7 @@
 [gearman]
 server=127.0.0.1
 
-[zuul]
+[scheduler]
 tenant_config=main.yaml
 
 [merger]
diff --git a/tests/fixtures/zuul-connections-same-gerrit.conf b/tests/fixtures/zuul-connections-same-gerrit.conf
index 8a998cf..3262294 100644
--- a/tests/fixtures/zuul-connections-same-gerrit.conf
+++ b/tests/fixtures/zuul-connections-same-gerrit.conf
@@ -1,7 +1,7 @@
 [gearman]
 server=127.0.0.1
 
-[zuul]
+[scheduler]
 tenant_config=config/zuul-connections-same-gerrit/main.yaml
 
 [merger]
diff --git a/tests/fixtures/zuul-git-driver.conf b/tests/fixtures/zuul-git-driver.conf
index b6d3473..4321871 100644
--- a/tests/fixtures/zuul-git-driver.conf
+++ b/tests/fixtures/zuul-git-driver.conf
@@ -1,7 +1,7 @@
 [gearman]
 server=127.0.0.1
 
-[zuul]
+[scheduler]
 tenant_config=config/zuul-connections-same-gerrit/main.yaml
 
 [merger]
diff --git a/tests/fixtures/zuul-sql-driver.conf b/tests/fixtures/zuul-sql-driver.conf
index 6fdd081..688d65b 100644
--- a/tests/fixtures/zuul-sql-driver.conf
+++ b/tests/fixtures/zuul-sql-driver.conf
@@ -1,9 +1,8 @@
 [gearman]
 server=127.0.0.1
 
-[zuul]
+[scheduler]
 tenant_config=main.yaml
-url_pattern=http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}
 
 [merger]
 git_dir=/tmp/zuul-test/merger-git
diff --git a/tests/fixtures/zuul.conf b/tests/fixtures/zuul.conf
index c4cfe70..d6de76c 100644
--- a/tests/fixtures/zuul.conf
+++ b/tests/fixtures/zuul.conf
@@ -1,7 +1,7 @@
 [gearman]
 server=127.0.0.1
 
-[zuul]
+[scheduler]
 tenant_config=main.yaml
 
 [merger]
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 03c6894..1476c38 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -451,7 +451,7 @@
             self.log.debug("Performing reconfiguration")
             loader = configloader.ConfigLoader()
             abide = loader.loadConfig(
-                self.config.get('zuul', 'tenant_config'),
+                self.config.get('scheduler', 'tenant_config'),
                 self._get_project_key_dir(),
                 self, self.merger, self.connections)
             for tenant in abide.tenants.values():
@@ -468,7 +468,7 @@
             self.log.debug("Performing tenant reconfiguration")
             loader = configloader.ConfigLoader()
             abide = loader.reloadTenant(
-                self.config.get('zuul', 'tenant_config'),
+                self.config.get('scheduler', 'tenant_config'),
                 self._get_project_key_dir(),
                 self, self.merger, self.connections,
                 self.abide, event.tenant)