Skip to contentSkip to conversation

sanity.bbclass: improve the network connectivity check message

PATCH In review Yu, Mingli 2 participants 2 messages Feb 10, 2021 – Feb 11, 2021

lore
Share & tools
lore

Yu, Mingli

author
#0 lore raw

PATCH 1/1 sanity.bbclass: improve the network connectivity check message

From: Mingli Yu <[email protected]>

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]

---
 meta/classes/sanity.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/sanity.bbclass +5 -1
index 485173ab48..ebf0a559a2 100644
@@ -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
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 35 lines · Mingli

From: Mingli Yu <[email protected]>

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]

---
 meta/classes/sanity.bbclass | 6 +++++-

 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/sanity.bbclass +0 -0
index 485173ab48..ebf0a559a2 100644
@@ -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.
meta/classes/sanity.bbclass +4 -0
+            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"
meta/classes/sanity.bbclass +1 -1
-            retval = msg
+            retval = urlmsg + msg
Quoted 2 lines

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