[Toaster] [PATCH] toaster: show https proxy in error output

Elliot Smith elliot.smith at intel.com
Tue Apr 19 05:19:26 PDT 2016


urllib2 automatically uses any http_proxy and https_proxy
settings from the environment. Now that the layer index is
available over https, there is a possibility that a user
may experience an error while fetching layer index. In this
situation, show the https_proxy setting as well as the
http_proxy setting in the error.

[YOCTO #9439]

Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
 bitbake/lib/toaster/orm/models.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 68c3072..90e3f6a 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1096,7 +1096,10 @@ class LayerIndexLayerSource(LayerSource):
 
         import urllib2, urlparse, json
         import os
-        proxy_settings = os.environ.get("http_proxy", None)
+        proxy_settings = (
+            os.environ.get("http_proxy", None),
+            os.environ.get("https_proxy", None)
+        )
         oe_core_layer = 'openembedded-core'
 
         def _get_json_response(apiurl = self.apiurl):
@@ -1116,7 +1119,7 @@ class LayerIndexLayerSource(LayerSource):
         except Exception as e:
             import traceback
             if proxy_settings is not None:
-                logger.info("EE: Using proxy %s" % proxy_settings)
+                logger.info("EE: Using HTTP proxy %s and HTTPS proxy %s" % proxy_settings)
             logger.warning("EE: could not connect to %s, skipping update: %s\n%s" % (self.apiurl, e, traceback.format_exc(e)))
             return
 
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the toaster mailing list