Skip to contentSkip to conversation

toaster: show https proxy in error output

PATCH In review Elliot Smith 2 participants 2 messages Jun 30, 2016 – Jul 5, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster: show https proxy in error output

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 the layer index via HTTPS. In this situation, show the https_proxy setting as well as the http_proxy setting in the error.

[YOCTO #9439]

---
 bitbake/lib/toaster/orm/models.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
bitbake/lib/toaster/orm/models.py +6 -3
index 61737c7..8f5e0f5 100644
@@ -1196,7 +1196,11 @@ class LayerIndexLayerSource(LayerSource):
             from urllib2 import urlopen, URLError
             from urlparse import urlparse
 
-        proxy_settings = os.environ.get("http_proxy", None)
+        proxy_settings = (
+            os.environ.get("http_proxy"),
+            os.environ.get("https_proxy")
+        )
+
         oe_core_layer = 'openembedded-core'
 
         def _get_json_response(apiurl = self.apiurl):
@@ -1215,8 +1219,7 @@ class LayerIndexLayerSource(LayerSource):
             apilinks = _get_json_response()
         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()))
             return
 
Signature · 1 line
2.7.4
#1 lore raw

For the benefit of the mailing list - Suggested we hold this off until it can be rebased on the database clean up branch

Michael

Quoted 41 lines · Elliot Smith

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 the layer index via HTTPS. In this situation, show the https_proxy setting as well as the http_proxy setting in the error.

[YOCTO #9439]

---
  bitbake/lib/toaster/orm/models.py | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
bitbake/lib/toaster/orm/models.py +6 -3
index 61737c7..8f5e0f5 100644
@@ -1196,7 +1196,11 @@ class LayerIndexLayerSource(LayerSource):
              from urllib2 import urlopen, URLError
              from urlparse import urlparse
 
-        proxy_settings = os.environ.get("http_proxy", None)
+        proxy_settings = (
+            os.environ.get("http_proxy"),
+            os.environ.get("https_proxy")
+        )
+
          oe_core_layer = 'openembedded-core'
 
          def _get_json_response(apiurl = self.apiurl):
@@ -1215,8 +1219,7 @@ class LayerIndexLayerSource(LayerSource):
              apilinks = _get_json_response()
          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()))
              return