]> git.ipfire.org Git - thirdparty/qemu.git/commit
tests/functional/asset: Add AssetError exception class
authorNicholas Piggin <npiggin@gmail.com>
Wed, 12 Mar 2025 13:00:02 +0000 (23:00 +1000)
committerThomas Huth <thuth@redhat.com>
Wed, 12 Mar 2025 17:20:50 +0000 (18:20 +0100)
commit28adad0a4d9f1f64f9f04748c6348a64ba7ad990
tree5d8268611ecab3edd496514dc474f59bf64a2210
parent7524e1b33679dc1356e8bb4efdd18e83fc50f5cc
tests/functional/asset: Add AssetError exception class

Assets are uniquely identified by human-readable-ish url, so make an
AssetError exception class that prints url with error message.

A property 'transient' is used to capture whether the client may retry
or try again later, or if it is a serious and likely permanent error.
This is used to retain the existing behaviour of treating HTTP errors
other than 404 as 'transient' and not causing precache step to fail.
Additionally, partial-downloads and stale asset caches that fail to
resolve after the retry limit are now treated as transient and do not
cause precache step to fail.

For background: The NetBSD archive is, at the time of writing, failing
with short transfer. Retrying the fetch at that position (as wget does)
results in a "503 backend unavailable" error. We would like to get that
error code directly, but I have not found a way to do that with urllib,
so treating the short-copy as a transient failure covers that case (and
seems like a reasonable way to handle it in general).

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-ID: <20250312130002.945508-4-npiggin@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/functional/qemu_test/asset.py