feat(scheduled-jobs): FreeBSD and OpenBSD through PosixScheduledJobsMixin (#27)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / test (3.12) (pull_request) Failing after 15s
driver / test (3.13) (pull_request) Failing after 13s
driver / types (pull_request) Failing after 25s
driver / lowest (pull_request) Failing after 19s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Failing after 36s
CI / driver (pull_request) Failing after 1m10s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / test (3.12) (pull_request) Failing after 15s
driver / test (3.13) (pull_request) Failing after 13s
driver / types (pull_request) Failing after 25s
driver / lowest (pull_request) Failing after 19s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Failing after 36s
CI / driver (pull_request) Failing after 1m10s
driver / publish (pull_request) Skipped
get_scheduled_jobs reads /etc/crontab and the user crontabs in /var/cron/tabs, on FreeBSD also both cron.d directories and every periodic script, in one round trip as root; manage_scheduled_job enables, disables or runs one now; put_ and delete_scheduled_job write and remove an application's own job (/etc/cron.d on FreeBSD, marked lines in the user's crontab on OpenBSD). A periodic script is what FreeBSD runs daily, weekly, monthly and for the security run; it does its work only when its periodic.conf knob says YES, so that knob is its enabled state, written with sysrc to /etc/periodic.conf. A later periodic.conf that still overrides it is reported instead of claimed as done. A script whose knob is not known only runs; one whose knob is off does nothing when run and offers no run. BSD su takes no shell (FreeBSD's -s is a MAC label) and -m starts root's own shell, csh on many FreeBSD hosts, so another user's job goes to /bin/sh on stdin. OpenBSD cron's -n/-q/-s flags are left off when a line runs now. What the base system ships is platform: FreeBSD's /etc/crontab and /etc/periodic, OpenBSD's newsyslog and /etc/daily|weekly|monthly lines, which stay one job each. get_cron_jobs goes: it read without root and missed cron.d, every other user and periodic. Requires napalm-device-types 4.26.0. Closes #27
This commit is contained in:
1 parent
fc3cade13a
commit
991e07043f
12 files changed
+1058
-69
No files matched your search
@@ -50,8 +50,6 @@ def _freebsd_host():
|
||||
"cat /etc/passwd": _read(s, "cat_etc_passwd.txt"),
|
||||
"cat /etc/group": _read(s, "cat_etc_group.txt"),
|
||||
BsdDriver.PS_COMMAND: _read(s, PS),
|
||||
"cat /etc/crontab": _read(s, "cat_etc_crontab.txt"),
|
||||
"crontab -l": "0 4 * * * /home/netork/backup.sh\n",
|
||||
},
|
||||
)
|
||||
|
||||
@@ -98,7 +96,6 @@ class TestIdentity:
|
||||
"get_lldp_neighbors",
|
||||
"get_os_users",
|
||||
"get_processes",
|
||||
"get_cron_jobs",
|
||||
],
|
||||
)
|
||||
def test_implements_what_the_poll_reads(self, cls, getter):
|
||||
@@ -198,15 +195,6 @@ class TestAccountsAndProcesses:
|
||||
init = next(p for p in _openbsd_vm().get_processes() if p["pid"] == 1)
|
||||
assert init["command"] == "/sbin/init"
|
||||
|
||||
def test_cron_jobs_from_the_system_and_the_login_users_crontab(self):
|
||||
jobs = _freebsd_host().get_cron_jobs()
|
||||
assert {"user": "root", "schedule": "0 * * * *", "command": "newsyslog"} in jobs
|
||||
assert {
|
||||
"user": "netork",
|
||||
"schedule": "0 4 * * *",
|
||||
"command": "/home/netork/backup.sh",
|
||||
} in jobs
|
||||
|
||||
|
||||
class TestListeningSockets:
|
||||
def test_freebsd_as_root_is_attributed(self):
|
||||
|
||||
Reference in new issue
Block a user