All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toaster: show https proxy in error output
@ 2016-06-30 10:21 Elliot Smith
  2016-07-05 15:51 ` Michael Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Elliot Smith @ 2016-06-30 10:21 UTC (permalink / raw)
  To: toaster

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]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 bitbake/lib/toaster/orm/models.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 61737c7..8f5e0f5 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -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
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] toaster: show https proxy in error output
  2016-06-30 10:21 [PATCH] toaster: show https proxy in error output Elliot Smith
@ 2016-07-05 15:51 ` Michael Wood
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Wood @ 2016-07-05 15:51 UTC (permalink / raw)
  To: toaster

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

Michael

On 30/06/16 11:21, 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 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]
>
> Signed-off-by: Elliot Smith <elliot.smith@intel.com>
> ---
>   bitbake/lib/toaster/orm/models.py | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
> index 61737c7..8f5e0f5 100644
> --- a/bitbake/lib/toaster/orm/models.py
> +++ b/bitbake/lib/toaster/orm/models.py
> @@ -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
>   



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] toaster: show https proxy in error output
  2016-04-19 12:19 Elliot Smith
@ 2016-05-24 14:40 ` Michael Wood
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Wood @ 2016-05-24 14:40 UTC (permalink / raw)
  To: toaster, elliot Smith

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 <elliot.smith@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)

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
>   



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] toaster: show https proxy in error output
@ 2016-04-19 12:19 Elliot Smith
  2016-05-24 14:40 ` Michael Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Elliot Smith @ 2016-04-19 12:19 UTC (permalink / raw)
  To: toaster

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@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.



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-05 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-30 10:21 [PATCH] toaster: show https proxy in error output Elliot Smith
2016-07-05 15:51 ` Michael Wood
  -- strict thread matches above, loose matches on Subject: below --
2016-04-19 12:19 Elliot Smith
2016-05-24 14:40 ` Michael Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.