rpm-ostree icon indicating copy to clipboard operation
rpm-ostree copied to clipboard

Add `rpm-ostree network-wait`

Open cgwalters opened this issue 3 years ago • 3 comments

I followed the docs for https://docs.fedoraproject.org/en-US/fedora-coreos/os-extensions/ and of course hit a race between network-online.target and actually being able to fetch the repos.

The idea of network-wait would be:

For each configured ostree remote and each enabled yum repository, wait until we can reach those over the network.

We could add rpm-ostree install -N to network-wait. It's actually kind of tempting to make it the default...

See also https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/gnetworkmonitor.h which would be good to use for this.

This also strongly relates to https://github.com/coreos/rpm-ostree/pull/3041#issuecomment-890129758

Also zincati could (should) use this instead of polling.

cgwalters avatar Aug 27 '21 21:08 cgwalters

Another thing we could do here is add retries; something like rpm-ostree install --retries=3 foo. We should also look at whether yum/dnf have a config flag for this we could honor.

cgwalters avatar Jul 28 '22 20:07 cgwalters

Another approach is to return a special exit code which can conveniently then be used in systemd units with e.g. RestartForceExitStatus=.

jlebon avatar Jul 28 '22 20:07 jlebon

https://github.com/rpm-software-management/librepo/issues/259 for the librepo side.

That said...we could also do the network-wait stuff on the libostree side. Speaking as an ostree upstream maintainer I'm 100% on board with adding an API to do this. And in most cases, if we wait on the network availability for the configured base ostree repository, my instinct says that in most cases the configured yum repositories are also accessible.

(OTOH, this network-wait thing would need to be implemented again for container remotes...)

cgwalters avatar Aug 02 '22 15:08 cgwalters