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] Add check_internet_connection function #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luc14n0
Copy link

@luc14n0 luc14n0 commented Apr 14, 2023

I made the assumption that transactional-update are only present in systems with NetworkManager. In case that's not true, please let me know so I can adjust it.

Please note that I haven't actually tested these changes as I'm not able to, currently. If someone could do some testing, it would be much appreciated by me.

@luc14n0 luc14n0 force-pushed the feature-make-t-u-more-resilient branch from 7cb21c5 to 2097214 Compare April 14, 2023 03:41
@thkukuk
Copy link
Collaborator

thkukuk commented Apr 14, 2023

I made the assumption that transactional-update are only present in systems with NetworkManager. In case that's not true, please let me know so I can adjust it.

transactional-update is also present on systems with e.g. wicked. There is no dependency to NetworkManager.
And could you please split the PR in two parts, one with the whitespace changes and one with only the real code changes? Currently the PR is really hard to read.

@luc14n0
Copy link
Author

luc14n0 commented Apr 14, 2023

Sure, I'm gonna split the PR and research whether wicked has a similar facility, otherwise we can put a condition there.

@luc14n0 luc14n0 force-pushed the feature-make-t-u-more-resilient branch from 2097214 to d9938a3 Compare April 14, 2023 23:41
@luc14n0 luc14n0 marked this pull request as draft April 14, 2023 23:41
@luc14n0 luc14n0 force-pushed the feature-make-t-u-more-resilient branch from d9938a3 to 3ce871e Compare April 14, 2023 23:58
@luc14n0
Copy link
Author

luc14n0 commented Apr 15, 2023

Wicked doesn't seem to have anything similar to nm-online. Maybe using a looped nslookup to some domain could do. Any suggestions are welcomed.

@luc14n0
Copy link
Author

luc14n0 commented Apr 18, 2023

I had an interesting experience.

I installed Wicked here and it pulled in sysconfig-netconfig, which in turn messed up name resolution. And nm-online was showing me that I was online -- I really was -- but without name resolution it's basically like being offline.

So if we go forward with this proposition of mine, we'd be better off using nslookup instead.

@luc14n0 luc14n0 force-pushed the feature-make-t-u-more-resilient branch from 3ce871e to af18f91 Compare April 28, 2023 00:07
@luc14n0
Copy link
Author

luc14n0 commented Apr 28, 2023

Alright, this should be ready, only waiting for #103 that I really would love to see getting merged.

I dropped the use of nm-online altogether in favor of nslookup running in a loop with intervals (5 seconds for now) between the calls. The number of lines of code grew greatly with this replacement, but now it should be more reliable and can work even with Wicked, or whatever network manager is being used.

@luc14n0
Copy link
Author

luc14n0 commented Jul 27, 2023

I'm gonna hold on on the re-indentation PR for now, and focus on redoing the check_internet_connection to not depend on that so we can move on discussing/declining it.

I do believe this check is interesting to have, since it will short-circuit the whole update transaction even before calling Zypper, since it makes sure we can resolve names (no only that we have internet connectivity) first.

Make sure that the system is online, by checking system's domain name
resolvability, with the help of nslookup tool. It waits up to 30
seconds (by default), while probing known worl-wide resilient internet
domains, to try to make up for loss of connectivity - especially for
systems with suspension enabled where after waking up they don't come
back online quick enough - before doing any operation that involves
downloading data with Zypper.

This feature also acts as a short-circuit for Zypper transactions bound
to fail due to working connection unavailability.
@luc14n0 luc14n0 force-pushed the feature-make-t-u-more-resilient branch from af18f91 to 9e78bc1 Compare August 2, 2023 04:26
@luc14n0 luc14n0 marked this pull request as ready for review August 2, 2023 04:28
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 this pull request may close these issues.

None yet

2 participants