Log a warning when zuul.conf is misconfigured
The legacy sections [gerrit] and [zuul] are loaded into connections
by those names. If a [connection gerrit] (or zuul) exists that
should take precedence over the legacy items.
Change-Id: I672af3e7e444f7049a1309428bbb92d580054db2
diff --git a/zuul/lib/connections.py b/zuul/lib/connections.py
index 92ddb0f..6159bfc 100644
--- a/zuul/lib/connections.py
+++ b/zuul/lib/connections.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import logging
import re
import zuul.connection.gerrit
@@ -19,6 +20,7 @@
def configure_connections(config):
+ log = logging.getLogger("configure_connections")
# Register connections from the config
# TODO(jhesketh): import connection modules dynamically
@@ -54,13 +56,21 @@
# connection named 'gerrit' or 'smtp' respectfully
if 'gerrit' in config.sections():
- connections['gerrit'] = \
- zuul.connection.gerrit.GerritConnection(
- 'gerrit', dict(config.items('gerrit')))
+ if 'gerrit' in connections:
+ log.warning("The legacy [gerrit] section will be ignored in favour"
+ " of the [connection gerrit].")
+ else:
+ connections['gerrit'] = \
+ zuul.connection.gerrit.GerritConnection(
+ 'gerrit', dict(config.items('gerrit')))
if 'smtp' in config.sections():
- connections['smtp'] = \
- zuul.connection.smtp.SMTPConnection(
- 'smtp', dict(config.items('smtp')))
+ if 'smtp' in connections:
+ log.warning("The legacy [smtp] section will be ignored in favour"
+ " of the [connection smtp].")
+ else:
+ connections['smtp'] = \
+ zuul.connection.smtp.SMTPConnection(
+ 'smtp', dict(config.items('smtp')))
return connections