← Back to team overview

curtin-dev team mailing list archive

[Merge] ~dbungert/curtin:jenkins-py-apt into curtin:master

 

Dan Bungert has proposed merging ~dbungert/curtin:jenkins-py-apt into curtin:master.

Commit message:
tox,control: fix jenkins CI jobs

Restore noproxy to support the CI jobs.
Adding sitepackages means that lookup of commands gets weird, but using
{envpython} -m foo solves that.
So we need two {envpythons}, one for noproxy, one for nose.
We could stuff that into the noproxy script but that would be unexpected
for a script that only adjusts the environment then execs the real
command.

Also include python3-apt in the control file.

Requested reviews:
  Michael Hudson-Doyle (mwhudson)

For more details, see:
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/408325
-- 
Your team curtin developers is subscribed to branch curtin:master.
diff --git a/debian/control b/debian/control
index 9fddcbd..9f0b71d 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Maintainer: Ubuntu Developers <ubuntu-devel-discuss@xxxxxxxxxxxxxxxx>
 Build-Depends: debhelper (>= 7),
                dh-python,
                python3,
+               python3-apt,
                python3-coverage,
                python3-mock,
                python3-nose,
@@ -49,6 +50,7 @@ Section: python
 Architecture: all
 Priority: extra
 Depends: curtin-common (= ${binary:Version}),
+         python3-apt,
          python3-oauthlib,
          python3-yaml,
          wget,
diff --git a/tools/noproxy b/tools/noproxy
new file mode 100644
index 0000000..911cc7a
--- /dev/null
+++ b/tools/noproxy
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# This file is part of curtin. See LICENSE file for copyright and license info.
+
+# clean http_proxy variables from environment as they make httpretty
+# fail, but may be in the environment for reasons such as pip install
+import os
+import sys
+
+for k in ('http_proxy', 'https_proxy', 'HTTP_PROXY', 'HTTPS_PROXY'):
+    if k in os.environ:
+        del os.environ[k]
+
+os.execvpe(sys.argv[1], sys.argv[1:], os.environ)
+
+# vi: ts=4 expandtab syntax=python
diff --git a/tools/run-pep8 b/tools/run-pep8
index 5c85ad0..227129c 100755
--- a/tools/run-pep8
+++ b/tools/run-pep8
@@ -8,6 +8,7 @@ pycheck_dirs=(
     "tools/report_webhook_logger"
     "tools/block-discover-to-config"
     "tools/curtin-log-print"
+    "tools/noproxy"
     "tools/schema-validate-storage"
     "tools/ssh-keys-list"
     "tools/vmtest-filter"
diff --git a/tox.ini b/tox.ini
index a0ca80c..f27dfbc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,7 +22,8 @@ setenv = VIRTUAL_ENV={envdir}
     LC_ALL = en_US.utf-8
 deps = -r{toxinidir}/test-requirements.txt
     -r{toxinidir}/requirements.txt
-commands = {envpython} -m nose \
+# noproxy needed for several of the curtin jenkins jobs
+commands = {envpython} {toxinidir}/tools/noproxy {envpython} -m nose \
     {posargs:--with-coverage --cover-erase --cover-branches \
        --cover-package=curtin --cover-inclusive tests/unittests}
 
@@ -111,13 +112,13 @@ deps = {[testenv:trusty]deps}
 
 basepython = python2.7
 sitepackages = true
-commands = {envpython} -m nose \
+commands = {envpython} {toxinidir}/tools/noproxy {envpython} -m nose \
     {posargs:tests/unittests}
 
 [testenv:trusty-py3]
 deps = {[testenv:trusty]deps}
 basepython = python3
-commands = {envpython} -m nose \
+commands = {envpython} {toxinidir}/tools/noproxy {envpython} -m nose \
     {posargs:tests/unittests}
 
 [testenv:xenial]
@@ -131,14 +132,14 @@ deps =
 basepython = python27
 deps = {[testenv:xenial]deps}
    {[testenv:py27]deps}
-commands = {envpython} -m nose \
+commands = {envpython} {toxinidir}/tools/noproxy {envpython} -m nose \
     {posargs:tests/unittests}
 
 [testenv:xenial-py3]
 basepython = python3
 sitepackages = true
 deps = {[testenv:xenial]deps}
-commands = {envpython} -m nose \
+commands = {envpython} {toxinidir}/tools/noproxy {envpython} -m nose \
     {posargs:tests/unittests}
 
 [testenv:tip-pycodestyle]

Follow ups