On 19/04/16 13:19, Elliot Smith wrote:
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 <[email protected]>
---
  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)

You don't need to specify None as the default value to return if there is no value for those keys as this is already the default

+        )
          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:


proxy_settings will always be True as it can be an tuple with 2x "None" in it, maybe use "if None not in proxy_settings"

-                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

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to