Skip to content

[feature] Wire persistent-mass-upgrade Beat tasks into ansible-openwisp2 #621#623

Open
Eeshu-Yadav wants to merge 2 commits into
gsoc26-persistent-scheduled-upgradesfrom
gsoc26/wire-persistent-upgrade-beat-tasks
Open

[feature] Wire persistent-mass-upgrade Beat tasks into ansible-openwisp2 #621#623
Eeshu-Yadav wants to merge 2 commits into
gsoc26-persistent-scheduled-upgradesfrom
gsoc26/wire-persistent-upgrade-beat-tasks

Conversation

@Eeshu-Yadav

@Eeshu-Yadav Eeshu-Yadav commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #621.

Related to openwisp/openwisp-firmware-upgrader#379 (parent — Persistent Mass Upgrades) and openwisp/openwisp-firmware-upgrader#436 (upstream implementation).

Description of Changes

Once openwisp-firmware-upgrader ships the persistent-mass-upgrades feature, an ansible-deployed install still won't fire its retry loop or its reminder notifications. The CELERY_BEAT_SCHEDULE = { … } block in templates/openwisp2/settings.py has Jinja gates for users, notifications, monitoring, radius and metrics but no firmware-upgrader entry. Operators would deploy the new release and quietly get none of the new behaviour.

This PR adds the missing entries.

  • A Jinja-gated block sits next to run_checks (the closest precedent, also a periodic scan). The gate is openwisp2_firmware_upgrader and openwisp2_firmware_upgrader_periodic_tasks, mirroring how monitoring/radius/metric_collection wire their Beat entries, so disabling firmware-upgrader at the role level hides the schedule too.
  • Three new role variables: openwisp2_firmware_upgrader_periodic_tasks (default true), openwisp2_firmware_upgrader_check_pending_period_minutes (default 10, the retry-scan period), openwisp2_firmware_upgrader_reminder_scan_period_days (default 7, how often the reminder task looks at long-running batches). The per-batch reminder cadence stays controlled upstream by OPENWISP_FIRMWARE_UPGRADER_PERSISTENT_REMINDER_PERIOD, default 60 days.
  • These are scan workloads, not fixed-clock cron jobs, so timedelta(...) is used rather than crontab(...) — matches run_checks. No cron_* string is needed in vars/main.yml.
  • The variables are documented in docs/user/role-variables.rst next to the existing *_periodic_tasks rows. The tracking issue suggests README.md, but the repo's per-variable reference actually lives in role-variables.rst — README.md is 20 lines and has no variable table. Happy to also add a README mention if reviewers prefer.

The second commit ([chores] TEMPORARY pin firmware-upgrader to gsoc26 branch in molecule converge) adds an openwisp2_firmware_upgrader_version override in molecule/resources/converge.yml only, so Molecule installs a version that actually ships the new tasks. defaults/main.yml stays untouched. Must be reverted before this branch merges to master.

…ders into the Beat schedule #621

Added the two new firmware-upgrader Beat entries to CELERY_BEAT_SCHEDULE in
templates/openwisp2/settings.py, gated on openwisp2_firmware_upgrader and a
new openwisp2_firmware_upgrader_periodic_tasks toggle mirroring the existing
monitoring/radius/metric_collection gating. Cadences come from two new ansible
variables (default 10 minutes and 7 days) so operators can tune from
inventory.

Uses timedelta() because these are scan workloads, not fixed-clock cron jobs.

Documented the three new variables in docs/user/role-variables.rst next to
the existing *_periodic_tasks rows.

Related to #621
Copilot AI review requested due to automatic review settings June 2, 2026 07:22
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2dd159b1-40ea-4777-aed7-59fed3c1b44d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gsoc26/wire-persistent-upgrade-beat-tasks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR wires the new persistent-mass-upgrade Celery Beat tasks from openwisp-firmware-upgrader into the ansible-openwisp2 role, adding role variables to control the scan cadences and to allow disabling the firmware-upgrader Beat entries.

Changes:

  • Adds two new firmware-upgrader entries to CELERY_BEAT_SCHEDULE, gated by openwisp2_firmware_upgrader and openwisp2_firmware_upgrader_periodic_tasks.
  • Introduces new default variables for enabling/disabling the firmware-upgrader periodic tasks and configuring their scan intervals (minutes/days), and documents them.
  • Updates the default openwisp2_firmware_upgrader_version pin (currently to a feature branch tarball).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
templates/openwisp2/settings.py Adds two new Celery Beat schedule entries for persistent upgrade retry/reminder scans, gated by role flags.
docs/user/role-variables.rst Documents the new firmware-upgrader periodic-task variables alongside other periodic-task flags.
defaults/main.yml Adds defaults for the new cadence variables and the periodic-task toggle; also changes the firmware-upgrader version pin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread defaults/main.yml Outdated
openwisp2_controller_version: "openwisp-controller @ https://github.com/openwisp/openwisp-controller/tarball/master"
openwisp2_network_topology_version: "openwisp-network-topology @ https://github.com/openwisp/openwisp-network-topology/tarball/master"
openwisp2_firmware_upgrader_version: "openwisp-firmware-upgrader @ https://github.com/openwisp/openwisp-firmware-upgrader/tarball/master"
openwisp2_firmware_upgrader_version: "openwisp-firmware-upgrader @ https://github.com/openwisp/openwisp-firmware-upgrader/tarball/gsoc26-persistent-scheduled-upgrades"
@Eeshu-Yadav
Eeshu-Yadav force-pushed the gsoc26/wire-persistent-upgrade-beat-tasks branch 2 times, most recently from 0dfd790 to eee0260 Compare June 2, 2026 10:43
…e converge — revert before merge

Molecule installs the master tarball by default, which does not yet ship
the new Beat tasks. Overriding only in the test inventory keeps the
production default in defaults/main.yml clean.

Points at the openwisp-firmware-upgrader branch issues/417-persistence-schema-fields
(the PR #436 head).

Revert this override before this branch merges to master, once PR #436 has
merged and a release is cut.

Related to #621
@Eeshu-Yadav
Eeshu-Yadav force-pushed the gsoc26/wire-persistent-upgrade-beat-tasks branch from eee0260 to 0f5fe44 Compare June 2, 2026 10:43
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