feat(scheduled-jobs): ScheduledJobsMixin and its POSIX implementation (#86), release 4.27.0 #87

Merged
christianmanivong merged 8 commits from feature/scheduled-jobs into main 2026-11-03 07:37:26 +00:00
Owner

Summary

The scheduled-jobs contract (NetOrk/netork#1933) and its POSIX implementation: what a host runs on its own schedule as one shape, switched on, off and now, and an application's own jobs written and deleted.

Changes

  • ScheduledJobsMixin, ScheduledJobDict, ScheduledJobsReadingDict, ScheduledJobSpecDict, ScheduledJobResultDict, job_digest, ScheduledJobChanged, ScheduledJobRefused (scheduled_jobs.py)
  • PosixScheduledJobsMixin over run_command: one framed report as root (crontab, cron.d, spools, run-parts, anacrontab, systemd timers and their units, time zone, package owners); switching (#napalm-disabled: marker, systemctl enable/disable --now, execute bit); run now bounded by timeout 300; an application's job as a timer, a cron.d file or marked crontab lines
  • napalm_device_types.cron: Vixie-cron parsing, next runs in a time zone, exact OnCalendar lines
  • get_cron_jobs / CronJobDict removed (no caller)
  • Version 4.26.0 so the driver branches can require it; the release commit only dates the changelog and tags

Related Issue

Closes #86 · NetOrk/netork#1933

Testing

1314 tests (the reading command run by a real sh against a directory tree with stand-in systemctl, crontab, dpkg, install), coverage 96 %, mypy strict, ruff, napalm-standard check and ratchet, bandit.

## Summary The scheduled-jobs contract (NetOrk/netork#1933) and its POSIX implementation: what a host runs on its own schedule as one shape, switched on, off and now, and an application's own jobs written and deleted. ## Changes - `ScheduledJobsMixin`, `ScheduledJobDict`, `ScheduledJobsReadingDict`, `ScheduledJobSpecDict`, `ScheduledJobResultDict`, `job_digest`, `ScheduledJobChanged`, `ScheduledJobRefused` (`scheduled_jobs.py`) - `PosixScheduledJobsMixin` over `run_command`: one framed report as root (crontab, cron.d, spools, run-parts, anacrontab, systemd timers and their units, time zone, package owners); switching (`#napalm-disabled: ` marker, `systemctl enable/disable --now`, execute bit); run now bounded by `timeout 300`; an application's job as a timer, a cron.d file or marked crontab lines - `napalm_device_types.cron`: Vixie-cron parsing, next runs in a time zone, exact `OnCalendar` lines - `get_cron_jobs` / `CronJobDict` removed (no caller) - Version 4.26.0 so the driver branches can require it; the release commit only dates the changelog and tags ## Related Issue Closes #86 · NetOrk/netork#1933 ## Testing 1314 tests (the reading command run by a real `sh` against a directory tree with stand-in `systemctl`, `crontab`, `dpkg`, `install`), coverage 96 %, mypy strict, ruff, `napalm-standard check` and `ratchet`, bandit.
christianmanivong added 1 commit 2026-11-03 04:29:40 +00:00
feat(scheduled-jobs): ScheduledJobsMixin and its POSIX implementation (#86)
driver / standard (pull_request) Successful in 20s
driver / lint (pull_request) Successful in 23s
driver / types (pull_request) Successful in 1m16s
driver / test (3.13) (pull_request) Successful in 1m18s
driver / test (3.12) (pull_request) Successful in 1m27s
driver / lowest (pull_request) Successful in 46s
driver / build (pull_request) Successful in 43s
driver / security (pull_request) Successful in 1m27s
CI / driver (pull_request) Successful in 3m11s
driver / publish (pull_request) Skipped
f573fa53d2
What a host runs on its own schedule as one shape: cron lines, run-parts
scripts, anacron, systemd timers, periodic, a platform's own jobs, Windows
tasks. Every job says who owns its definition and what the driver can do
to it; every write names the digest the caller saw and is refused when the
host's definition changed since.

PosixScheduledJobsMixin reads everything in one framed report as root,
switches a cron line behind #napalm-disabled:, a timer by systemctl and a
run-parts script by its execute bit, runs a job now bounded by timeout, and
writes an application's job as a timer where systemd runs, else in
/etc/cron.d or the user's crontab. napalm_device_types.cron parses cron
expressions, gives their next runs and writes them as OnCalendar lines.

get_cron_jobs and CronJobDict go: nothing called them.

Version 4.26.0, so drivers can require it before the release is tagged.

Closes #86
christianmanivong added 1 commit 2026-11-03 04:30:20 +00:00
fix(scheduled-jobs): an own job goes to /etc/cron.d only where the host has it
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m21s
driver / lowest (pull_request) Successful in 39s
driver / test (3.13) (pull_request) Successful in 1m21s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 3m3s
driver / publish (pull_request) Skipped
834cb2e0ea
BusyBox crond reads no /etc/cron.d, so an Alpine host without systemd
takes the job in the user's crontab instead of a file it would never run.

Refs #86
christianmanivong added 1 commit 2026-11-03 04:33:14 +00:00
feat(scheduled-jobs): the install command, time zone, owners and platform sources are the driver's
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 39s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 2m48s
driver / publish (pull_request) Skipped
df476a12f2
A BSD install takes -D as a destdir, OpenWrt keeps its time zone in uci
and its package database in opkg, and a platform's generated files are its
own; each is a class attribute a driver sets.

Refs #86
christianmanivong added 1 commit 2026-11-03 04:39:57 +00:00
fix(scheduled-jobs): write a linked crontab through its link, with the target's mode
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 20s
driver / types (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m25s
driver / test (3.13) (pull_request) Successful in 1m18s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 36s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Successful in 2m54s
driver / publish (pull_request) Skipped
edef6cf07c
stat without -L gave the link's own mode, 777, and install replaced the
link with a plain file of that mode: cron ignores a file anyone may write,
so every job in it stopped (/etc/cron.d/vzdump on older PVE links to
/etc/pve/vzdump.cron). The file the link names is written instead.

Refs #86
christianmanivong added 1 commit 2026-11-03 04:50:44 +00:00
fix(scheduled-jobs): a file without a last newline no longer swallows the next header
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / build (pull_request) Successful in 32s
driver / lowest (pull_request) Successful in 41s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Successful in 2m43s
driver / publish (pull_request) Skipped
ffbb194300
GNU sed keeps a missing final newline, so the next section's header ran
on into the file's last line and its jobs were lost. The report ends
every such file with a newline of its own.

Refs #86
christianmanivong added 1 commit 2026-11-03 07:11:49 +00:00
fix(scheduled-jobs): a monotonic timer as its unit file says it, OnUnitActiveSec
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 43s
driver / test (3.13) (pull_request) Successful in 1m14s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Successful in 2m47s
driver / publish (pull_request) Skipped
c6d119eb83
systemctl show names a timer's monotonic settings by their properties,
OnUnitActiveUSec=3h; the schedule now reads as the unit file writes it.
Found on a live Ubuntu host.

Refs #86
christianmanivong changed title from feat(scheduled-jobs): ScheduledJobsMixin and its POSIX implementation (#86) to feat(scheduled-jobs): ScheduledJobsMixin and its POSIX implementation (#86), release 4.27.0 2026-11-03 07:34:15 +00:00
christianmanivong added 2 commits 2026-11-03 07:34:15 +00:00
# Conflicts:
#	CHANGELOG.md
chore(release): 4.27.0
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m20s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m33s
driver / publish (pull_request) Skipped
70e1c9b218
Scheduled jobs (NetOrk/netork#1933): ScheduledJobsMixin, its POSIX
implementation and napalm_device_types.cron. 4.26.0 went out meanwhile
with the sshd drop-in change, so this is 4.27.0.
christianmanivong merged commit 4e40f95bc1 into main 2026-11-03 07:37:26 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Blocks
You do not have permission to read 1 dependency
Reference: NAPALM/napalm-device-types#87