From b3929b5633188a36be0ac6ede92bfadda9e00eac Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 1 Nov 2019 08:27:48 +0900 Subject: [PATCH] Revert "Add the process environment to zuul.conf parser" In prod for OpenDev we're seeing things like this: http://paste.openstack.org/show/785704/ which lead us to believe this is somehow connected. This reverts commit f2229705f303ad71d37e98323e3f43031e4e0197. Change-Id: I0b73b71f72483e6c6e511411c3c59729761cec9b --- doc/source/admin/components.rst | 5 --- doc/source/admin/examples/docker-compose.yaml | 4 --- doc/source/admin/examples/etc_zuul/zuul.conf | 2 +- tests/unit/test_cmd.py | 33 ------------------- zuul/cmd/__init__.py | 2 +- 5 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 tests/unit/test_cmd.py diff --git a/doc/source/admin/components.rst b/doc/source/admin/components.rst index 10dcb316c8..62053b390e 100644 --- a/doc/source/admin/components.rst +++ b/doc/source/admin/components.rst @@ -75,11 +75,6 @@ location may be supplied on the command line) which uses an INI file syntax. Each component may have its own configuration file, though you may find it simpler to use the same file for all components. -Zuul will interpolate environment variables given in the config file -escaped as python string expansion, so ``foo=%(HOME)s`` will set the -value of ``foo`` to the same value as the environment variable named -``HOME``. - An example ``zuul.conf``: .. code-block:: ini diff --git a/doc/source/admin/examples/docker-compose.yaml b/doc/source/admin/examples/docker-compose.yaml index 785cfdfe71..99df901630 100644 --- a/doc/source/admin/examples/docker-compose.yaml +++ b/doc/source/admin/examples/docker-compose.yaml @@ -46,7 +46,6 @@ services: - http_proxy - https_proxy - no_proxy=${no_proxy},gerrit - - ZUUL_MYSQL_PASSWORD=secret command: "sh -c '/var/playbooks/wait-to-start.sh && zuul-scheduler -d'" # FIXME: The scheduler has no ansible anymore so use the executor image. # This needs to be changes such that ansible is not required for startup. @@ -63,8 +62,6 @@ services: ports: - "9000:9000" image: zuul/zuul-web - environment: - ZUUL_MYSQL_PASSWORD: secret volumes: - "./etc_zuul/:/etc/zuul/:z" - "./playbooks/:/var/playbooks/:z" @@ -74,7 +71,6 @@ services: - http_proxy - https_proxy - no_proxy=${no_proxy},gerrit,scheduler - - ZUUL_MYSQL_PASSWORD=secret command: "zuul-executor -d" depends_on: - scheduler diff --git a/doc/source/admin/examples/etc_zuul/zuul.conf b/doc/source/admin/examples/etc_zuul/zuul.conf index 8b8c34c236..b60a1604ee 100644 --- a/doc/source/admin/examples/etc_zuul/zuul.conf +++ b/doc/source/admin/examples/etc_zuul/zuul.conf @@ -28,7 +28,7 @@ baseurl=https://opendev.org [connection "mysql"] name=mysql driver=sql -dburi=mysql+pymysql://zuul:%(ZUUL_MYSQL_PASSWORD)s@mysql/zuul +dburi=mysql+pymysql://zuul:secret@mysql/zuul [web] listen_address=0.0.0.0 diff --git a/tests/unit/test_cmd.py b/tests/unit/test_cmd.py deleted file mode 100644 index 325ccd284b..0000000000 --- a/tests/unit/test_cmd.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2013 Hewlett-Packard Development Company, L.P. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import fixtures -import tempfile -import testtools - -import zuul.cmd - - -class TestCmd(testtools.TestCase): - def test_read_config_with_environment(self): - "Test that readConfig interpolates environment vars" - - with tempfile.NamedTemporaryFile() as test_config: - test_config.write(b'[DEFAULT]\nfoo=%(ENV_TEST)s\n') - test_config.flush() - with fixtures.EnvironmentVariable('ENV_TEST', 'baz'): - app = zuul.cmd.ZuulApp() - app.parseArguments(['-c', test_config.name]) - app.readConfig() - self.assertEquals('baz', app.config.get('DEFAULT', 'foo')) diff --git a/zuul/cmd/__init__.py b/zuul/cmd/__init__.py index 8ceafa6f22..0c2204e4f7 100755 --- a/zuul/cmd/__init__.py +++ b/zuul/cmd/__init__.py @@ -123,7 +123,7 @@ class ZuulApp(object): return parser def readConfig(self): - self.config = configparser.ConfigParser(os.environ) + self.config = configparser.ConfigParser() if self.args.config: locations = [self.args.config] else: