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.
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
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.
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
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
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
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
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
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.02026-11-03 07:34:15 +00:00
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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)PosixScheduledJobsMixinoverrun_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 bytimeout 300; an application's job as a timer, a cron.d file or marked crontab linesnapalm_device_types.cron: Vixie-cron parsing, next runs in a time zone, exactOnCalendarlinesget_cron_jobs/CronJobDictremoved (no caller)Related Issue
Closes #86 · NetOrk/netork#1933
Testing
1314 tests (the reading command run by a real
shagainst a directory tree with stand-insystemctl,crontab,dpkg,install), coverage 96 %, mypy strict, ruff,napalm-standard checkandratchet, bandit.feat(scheduled-jobs): ScheduledJobsMixin and its POSIX implementation (#86)to feat(scheduled-jobs): ScheduledJobsMixin and its POSIX implementation (#86), release 4.27.0