feat(scheduled-jobs): scheduled jobs on QTS's crontab (#17)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Failing after 56s
driver / test (3.12) (pull_request) Failing after 46s
driver / lowest (pull_request) Failing after 20s
driver / test (3.13) (pull_request) Failing after 47s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Failing after 1m4s
CI / driver (pull_request) Failing after 2m18s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Failing after 56s
driver / test (3.12) (pull_request) Failing after 46s
driver / lowest (pull_request) Failing after 20s
driver / test (3.13) (pull_request) Failing after 47s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Failing after 1m4s
CI / driver (pull_request) Failing after 2m18s
driver / publish (pull_request) Skipped
napalm-linux now brings napalm-device-types' POSIX scheduled jobs, with Debian's paths. On QTS they are wrong: the crontab that survives a boot is /etc/config/crontab (admin's, no user field), crond runs a copy of it, and a change made only through crontab is gone after the next boot. BusyBox crond reads no /etc/crontab, cron.d, run-parts or anacron, and there is no systemd. QtsScheduledJobsMixin reads /etc/config/crontab as admin's and the other users' crontabs from crond's spool in one round trip, and writes the file first, then loads it and restarts crond. The firmware's own lines are platform by a conservative command list and only run, until a real box shows whether QTS leaves one switched off alone. An application's job is marked lines in admin's crontab; a run is bounded without timeout, which QTS's BusyBox cannot be relied on to have. Requires napalm-device-types 4.26.0 and napalm-linux 0.16.0. Closes #17
This commit is contained in:
1 parent
e2074a2381
commit
2a4403101a
7 files changed
+700
-4
No files matched your search
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Scheduled jobs on QTS (#17, NetOrk/netork#1933). napalm-linux now brings
|
||||
napalm-device-types' POSIX scheduled jobs with Debian's paths, which are wrong on QTS;
|
||||
`QtsScheduledJobsMixin` puts them on QTS's:
|
||||
- `get_scheduled_jobs()` reads `/etc/config/crontab` -- the crontab QTS keeps across a
|
||||
boot, admin's (uid 0), without a user field -- and the other users' crontabs in
|
||||
crond's spool, in one round trip. crond's copy of admin's is not read twice. No
|
||||
`/etc/crontab`, cron.d, run-parts, anacron or systemd: BusyBox crond reads none of
|
||||
them. The time zone is QTS's own (`getcfg System 'Time Zone'`) when it is an IANA
|
||||
name. A box without `/etc/config/crontab` raises rather than reporting no jobs.
|
||||
- The firmware's own lines (`/sbin/hwclock -s`, `/sbin/qfstrim`,
|
||||
`/etc/init.d/backup_conf.sh`, ...) are `platform`, by a conservative list of the
|
||||
commands stock QTS writes; a line that also runs something else stays the admin's.
|
||||
They only **run**: QTS's scripts and UI keep these lines, and whether they leave one
|
||||
switched off alone needs a real box (#13).
|
||||
- `manage_scheduled_job()` switches the admin's lines and runs any line now. A write
|
||||
goes into `/etc/config/crontab` (`cp`, so the file keeps its mode, owner and links),
|
||||
then `crontab /etc/config/crontab` and `/etc/init.d/crond.sh restart` -- without
|
||||
them QTS forgets it on the next boot. A run is bounded by `sleep` and `kill`, not
|
||||
`timeout`, which QTS's BusyBox cannot be relied on to have.
|
||||
- `put_scheduled_job()` and `delete_scheduled_job()` keep an application's job as
|
||||
marked lines in `/etc/config/crontab`, never in a cron.d. Only as admin (`root` is
|
||||
taken for it): every other crontab lives in RAM and is gone after a boot.
|
||||
- Requires napalm-device-types 4.26.0 and napalm-linux 0.16.0.
|
||||
|
||||
### Changed
|
||||
- Personal accounts are switched off (`get_local_accounts`, `add_local_account`,
|
||||
`lock_local_account` = `None`). napalm-linux now adds and locks accounts with
|
||||
|
||||
Reference in new issue
Block a user