[elbe-devel] [PATCH 06/13] unset proxy config if not specified in XML

Torben Hohn torben.hohn at linutronix.de
Wed Dec 6 10:40:19 CET 2017


On Thu, Nov 30, 2017 at 03:15:08PM +0100, Manuel Traut wrote:
> os.environ is persistent for multiple requests to elbe-daemon.
> So the proxy configuration of a recent build is still active
> for a new build that didn't specify any proxy. This change
> sets the proxy env vars to an empty string if no proxy was
> specified

This is better than nothing.
However, we should actually identify, where these variables are used,
and make sure, that these cases are either isolated in separate
processes (RpcAptCache is a separate process) or if we call wget via
system or something, we seed the environment when starting the process.

Because this is obviously a race condition, once we start sharing an
initvm, and doing 2 builds at once.

> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>

Reviewed-by: Torben Hohn <torbenh at linutronix.de>

> ---
>  elbepack/elbexml.py | 4 ++++
>  elbepack/rfs.py     | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> index b280158a..e257856a 100644
> --- a/elbepack/elbexml.py
> +++ b/elbepack/elbexml.py
> @@ -221,6 +221,10 @@ class ElbeXML(object):
>              proxy = self.prj.text ("mirror/primary_proxy").strip().replace("LOCALMACHINE", "10.0.2.2")
>              os.environ ["http_proxy"] = proxy
>              os.environ ["https_proxy"] = proxy
> +        else:
> +            os.environ ["http_proxy"] = ""
> +            os.environ ["https_proxy"] = ""
> +            os.environ["no_proxy"] = ""
>  
>          passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
>          authhandler = urllib2.HTTPBasicAuthHandler(passman)
> diff --git a/elbepack/rfs.py b/elbepack/rfs.py
> index 2fa8f1a4..1a72dc81 100644
> --- a/elbepack/rfs.py
> +++ b/elbepack/rfs.py
> @@ -99,6 +99,10 @@ class BuildEnv ():
>              proxy = self.xml.prj.text("mirror/primary_proxy").strip().replace("LOCALMACHINE", "localhost")
>              os.environ["http_proxy"] = proxy
>              os.environ["https_proxy"] = proxy
> +        else:
> +            os.environ["no_proxy"] = ""
> +            os.environ["http_proxy"] = ""
> +            os.environ["https_proxy"] = ""
>  
>          os.environ["LANG"] = "C"
>          os.environ["LANGUAGE"] = "C"
> -- 
> 2.15.1
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20171206/01977679/attachment.sig>


More information about the elbe-devel mailing list