Skip to content

Commit 4b4ecec

Browse files
committed
Convert TEST_*_PROXY to *_proxy env vars
If TEST_{NO,HTTP,HTTPS}_PROXY are provided, convert them to http_proxy etc so that code will use them. This will apply to all code under zaza.openstack.
1 parent 178230e commit 4b4ecec

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

zaza/openstack/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
import tempfile
1919

2020

21+
def _set_proxy_vars():
22+
# Set proxy vars if provided so that all code gets to use it.
23+
for key, val in os.environ.items():
24+
if not key.startswith('TEST_') or 'PROXY' not in key:
25+
continue
26+
27+
_key = key.partition('TEST_')[2]
28+
os.environ[_key.lower()] = val
29+
30+
2131
# The temporary directory can't be used when juju's snap is installed in strict
2232
# mode, so zaza-openstack-tests changes the default tmp directory to the
2333
# directory referenced by TEST_TMPDIR otherwise a directory is created under
@@ -34,4 +44,5 @@ def _set_tmpdir():
3444
tempfile.tempdir = tmpdir
3545

3646

47+
_set_proxy_vars()
3748
_set_tmpdir()

0 commit comments

Comments
 (0)