Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fail and retry on "Some index files failed to download"
APT doesn't error out even in the following case since it's a warning instead of an error. And it allows charms to move on without having a proper APT index and let them install unwanted versions of software for example. The apt_update part should fail if it's marked as fatal in such cases so that it can be retried or charm can raise it as an error to users appropriately. "--error-on=any" is supported for >= bionic. https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1693900 Closes: #910 [w/o "--error-on=any"] ``` $ sudo apt-get update; echo $? ... Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2). - connect (113: No route to host) Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2). - connect (113: No route to host) Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease Unable to connect to squid-deb-proxy.lxd:8000: Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease Unable to connect to squid-deb-proxy.lxd:8000: Reading package lists... Done W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2). - connect (113: No route to host) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Unable to connect to squid-deb-proxy.lxd:8000: ... W: Some index files failed to download. They have been ignored, or old ones used instead. ``` -> 0 [w/ "--error-on=any"] ``` $ sudo apt-get --error-on=any update; echo $? ... E: Some index files failed to download. They have been ignored, or old ones used instead. ``` -> 100
- Loading branch information