toaster: show https proxy in error output
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 layer index. 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
bitbake/lib/toaster/orm/models.py +5 -2
@@ -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
Signature · 12 lines
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.
Quoted 19 lines · Elliot Smith
urllib2 automatically uses any
http_proxyandhttps_proxysettings 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 thehttps_proxysetting as well as thehttp_proxysetting 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(-)bitbake/lib/toaster/orm/models.py +0
-0
bitbake/lib/toaster/orm/models.py class LayerIndexLayerSource(LayerSource): · line 1101
Quoted 7 lines
bitbake/lib/toaster/orm/models.py +3
-1@@ -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
bitbake/lib/toaster/orm/models.py class LayerIndexLayerSource(LayerSource): · line 1121
Quoted 8 lines
bitbake/lib/toaster/orm/models.py +1
-0+ ) 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"
Quoted 5 lines
bitbake/lib/toaster/orm/models.py +1
-1- 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