Skip to content

fix(update-module): skip missing previous images - #1358

Merged
DavidePrincipi merged 1 commit into
mainfrom
fix-update-module-prev-image
Oct 15, 2026
Merged

DavidePrincipi merged 1 commit into
mainfrom
fix-update-module-prev-image

Conversation

@DavidePrincipi

Copy link
Copy Markdown
Member

When a module update adds an image the module did not have before, update-module stores PREV_<NAME>_IMAGE=None in the module environment, and the cleanup step then runs podman image rm None. The update succeeds, but the log shows a failed removal and the bogus variable stays in the environment. It was found while testing ns8-metrics 1.6.0-dev.1, which adds the metrics-grafana image. NethServer/dev#8210

Updates now record a previous image only when one exists, and remove a stale previous value otherwise. The cleanup step also skips empty and None values, so environments already holding None from earlier releases are handled. Updates that replace an image behave as before.

  • update-module/05pullimages: set PREV_<NAME>_IMAGE only if <NAME>_IMAGE was already set, otherwise unset it
  • update-module/95cleanup_images: skip previous images that are empty or None; complements fix(update-module): handle missing PREV_IMAGE_URL #1340, which did the same for PREV_IMAGE_URL

How to test

  • On a module whose new release adds an image (e.g. metrics 1.5.1 to 1.6.0-dev.1), run update-module and check that no PREV_<NAME>_IMAGE=None is written and the log has no podman image rm None
  • On a module environment already holding PREV_<NAME>_IMAGE=None, run an update and check that the value is removed without errors
  • Update a module to a release that changes an image and check that the previous image is still removed

These cases were checked on a test node (core 3.23.0 with the two patched steps copied in), including a direct run of 95cleanup_images with None, empty and real previous images.

See also


Generated by Claude Code:claude-opus-5.5 with nethserver-pr

When an update adds an image the module did not have, there is no
previous image, but the environment stored PREV_<NAME>_IMAGE=None and
the cleanup step ran "podman image rm None", logging an error.

Store PREV_<NAME>_IMAGE only when a previous image exists, and remove
a stale one otherwise. The cleanup step also skips empty and "None"
values, which earlier releases left in module environments.

Assisted-by: Claude Code:claude-opus-5.5
@DavidePrincipi
DavidePrincipi merged commit fe8b95e into main Oct 15, 2026
2 checks passed
@DavidePrincipi
DavidePrincipi deleted the fix-update-module-prev-image branch October 15, 2026 09:11
@DavidePrincipi

Copy link
Copy Markdown
Member Author

Tested on a single-node cluster with core 3.23.1-dev.7 (updated from 3.23.1-dev.5), updating metrics1 from 1.5.1 to 1.6.0. In 1.6.0 prometheus and alertmanager change, and metrics-grafana replaces grafana.

Case Result
Update changes an image ✅ PREV_PROMETHEUS_IMAGE and PREV_ALERTMANAGER_IMAGE are set and the old images are removed
Update adds an image ✅ With METRICS_GRAFANA_IMAGE unset, a forced update to 1.6.0 sets only METRICS_GRAFANA_IMAGE, and a stale PREV_METRICS_GRAFANA_IMAGE is unset
Environment already holds PREV_<NAME>_IMAGE=None ✅ 95cleanup_images skips it: no podman image rm None, no errors

PREV_GRAFANA_IMAGE=None was injected for an image that 1.6.0 no longer lists. 05pullimages does not touch it, so the value stays in the environment. It is harmless because the cleanup step skips it.

The unrelated PREV_IMAGE_URL path logged Error: ghcr.io/nethserver/metrics:1.5.1: image not known, because the module image was not in the module's image storage. The update still succeeded.

All metrics services were running after each update.


Assisted-by: Claude Code:claude-opus-5-5

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.

2 participants