All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sanity.bbclass: improve the network connectivity check message
@ 2021-02-10  2:46 Yu, Mingli
  2021-02-11 12:55 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Yu, Mingli @ 2021-02-10  2:46 UTC (permalink / raw)
  To: openembedded-core

From: Mingli Yu <mingli.yu@windriver.com>

The network connectivity check via checking www.example.com by default
and also can customized by CONNECTIVITY_CHECK_URIS if desired.

Improve the check message to let the user know if the network is actually
unaccessible or the checked URIs is wrongly set.

[YOCTO #12708]

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 meta/classes/sanity.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 485173ab48..ebf0a559a2 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -389,13 +389,17 @@ def check_connectivity(d):
         except Exception as err:
             # Allow the message to be configured so that users can be
             # pointed to a support mechanism.
+            urlmsg = "Check network connectivity via the below tested URIs\n"
+            urlmsg += "    please make sure the below tested URIs accessible\n"
+            for test_uri in test_uris:
+                urlmsg = "    %s\n" % test_uri.strip()
             msg = data.getVar('CONNECTIVITY_CHECK_MSG') or ""
             if len(msg) == 0:
                 msg = "%s.\n" % err
                 msg += "    Please ensure your host's network is configured correctly,\n"
                 msg += "    or set BB_NO_NETWORK = \"1\" to disable network access if\n"
                 msg += "    all required sources are on local disk.\n"
-            retval = msg
+            retval = urlmsg + msg
 
     return retval
 
-- 
2.17.1


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

* Re: [OE-core] [PATCH] sanity.bbclass: improve the network connectivity check message
  2021-02-10  2:46 [PATCH] sanity.bbclass: improve the network connectivity check message Yu, Mingli
@ 2021-02-11 12:55 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2021-02-11 12:55 UTC (permalink / raw)
  To: Yu, Mingli, openembedded-core

On Wed, 2021-02-10 at 10:46 +0800, Yu, Mingli wrote:
> From: Mingli Yu <mingli.yu@windriver.com>
> 
> The network connectivity check via checking www.example.com by default
> and also can customized by CONNECTIVITY_CHECK_URIS if desired.
> 
> Improve the check message to let the user know if the network is actually
> unaccessible or the checked URIs is wrongly set.
> 
> [YOCTO #12708]
> 
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> ---
>  meta/classes/sanity.bbclass | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 485173ab48..ebf0a559a2 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -389,13 +389,17 @@ def check_connectivity(d):
>          except Exception as err:
>              # Allow the message to be configured so that users can be
>              # pointed to a support mechanism.
> +            urlmsg = "Check network connectivity via the below tested URIs\n"
> +            urlmsg += "    please make sure the below tested URIs accessible\n"
> +            for test_uri in test_uris:
> +                urlmsg = "    %s\n" % test_uri.strip()
>              msg = data.getVar('CONNECTIVITY_CHECK_MSG') or ""
>              if len(msg) == 0:
>                  msg = "%s.\n" % err
>                  msg += "    Please ensure your host's network is configured correctly,\n"
>                  msg += "    or set BB_NO_NETWORK = \"1\" to disable network access if\n"
>                  msg += "    all required sources are on local disk.\n"
> -            retval = msg
> +            retval = urlmsg + msg
>  
> 


The idea was to allow things like toaster as a UI to override the
message entirely so this should probably just add to the len(msg) == 0
case. Probably something like:

if not msg:
    msg = "%s.\n" % err
    msg += "    Please ensure your host's network is configured correctly,\n"
    msg += "    or set BB_NO_NETWORK = \"1\" to disable network access if\n"
    msg += "    all required sources are on local disk.\n"
    msg += "    The urls tested were:
    for test_uri in test_uris:
        msg += "        %s\n" % test_uri.strip()

len(msg) == 0 is a horrible test so I tweaked that too :)

Cheers,

Richard





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

end of thread, other threads:[~2021-02-11 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-10  2:46 [PATCH] sanity.bbclass: improve the network connectivity check message Yu, Mingli
2021-02-11 12:55 ` [OE-core] " Richard Purdie

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.