Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: reduce timeout for the 'Checking internet connectivity' check #1047

Closed
larsbu opened this issue Jan 25, 2024 · 1 comment · Fixed by #1049
Closed

Feature Request: reduce timeout for the 'Checking internet connectivity' check #1047

larsbu opened this issue Jan 25, 2024 · 1 comment · Fixed by #1049

Comments

@larsbu
Copy link
Contributor

larsbu commented Jan 25, 2024

During a conversion from CentOS7 to RHEL7 I noticed that the timeout of the internet connectivity check took some time:

[2024-01-25T06:16:38+0000] DEBUG - Booted kernel VRA (version, release, architecture): 3.10.0-1160.102.1.el7.x86_64
Checking internet connectivity using address 'https://static.redhat.com/test/rhel-networkmanager.txt'.
WARNING - There was a problem while trying to connect to 'https://static.redhat.com/test/rhel-networkmanager.txt' to check internet connectivity. This could be due to the host being offline, or the network blocking access to the endpoint... Some checks and actions will be skipped.
[2024-01-25T06:18:46+0000] DEBUG - Failed to retrieve data from host, reason: [Errno 101] Network is unreachable

It is possible to lower the timeout?
15-20 seconds should be sufficient.

Version: convert2rhel-1.6.1-1.el7
Location: systeminfo.py, _check_internet_access

Maybe using the timeout option?

diff --git a/convert2rhel/systeminfo.py b/convert2rhel/systeminfo.py
index ce9afe9..6684716 100644
--- a/convert2rhel/systeminfo.py
+++ b/convert2rhel/systeminfo.py
@@ -390,7 +390,7 @@ class SystemInfo:
         try:
             # urlopen as a context manager is only available in Python-3.0+
             # pylint: disable=consider-using-with
-            response = urllib.request.urlopen(CHECK_INTERNET_CONNECTION_ADDRESS)
+            response = urllib.request.urlopen(CHECK_INTERNET_CONNECTION_ADDRESS, timeout=15)
             response.close()
             # pylint: enable=consider-using-with
             self.logger.info(
@Venefilyn
Copy link
Member

Good suggestion! Can you submit a PR for the patch as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants