Clean up and refactor contrib/update.py#1255
Open
ideaship wants to merge 4 commits into
Open
Conversation
Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Roger Luethi <luethi@osism.tech>
Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Roger Luethi <luethi@osism.tech>
Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Roger Luethi <luethi@osism.tech>
test/unit/test_update.py imports the updater as `contrib.update`, but
contrib/ had no __init__.py, so `mypy .` (as run in CI) discovered
contrib/update.py under two module names ("update" and "contrib.update")
and aborted: "Source file found twice under different module names".
Make contrib a package, matching openstack_image_manager, so the file
resolves to a single module name and mypy passes.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Roger Luethi <luethi@osism.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Refactors
contrib/update.py(the scheduled image-definition updater) in three commits:Remove the dead mirror path + fix
--dry-run.update.pycarried its own MinIO upload (mirror_image) that broke in the Oct 2025 object-store migration — the default bucket nameosism/openstack-imagescontains a/and is rejected by the minio client — and duplicated whatcontrib/mirror.pyalready does. It only ran in the non---dry-runpath, which CI never exercises, so it sat broken for months. Removed it;mirror.pyremains the sole uploader.--dry-runnow honestly means "compute but do not write the YAML" (previously it rewrote the file regardless), and the scheduled workflow drops the flag so it still opens update PRs.Add a golden characterization test covering all six upstream parsing variants (AlmaLinux plain, CentOS 7 / Stream BSD + dated-filename, Rocky BSD, Ubuntu/Debian directory-listing), so the refactor is provably behaviour-preserving.
Refactor discovery into pluggable handlers. Replace the per-
shortnameif/elifchecksum-parsing branches withMirrorDirHandler/DirListingHandler, selected by adistro → handlerregistry plus ashortname → configtable. Adding a new major becomes a config line instead of a code branch. Adds explicit request timeouts.Testing
tox -e test -- test/unit— golden +--dry-runwrite-contract tests pass; parity confirmed against live upstream.Notes
No change to the values
update.pyproduces — the golden test pins that. This is groundwork for adding current distro majors; follow-up branches build on it.🤖 Generated with Claude Code