Krikri::PluginHelpers::CronTable
CronTable - pure logic for managing a named entry inside a crontab-style text file. Ansible's cron module identifies "its" entry by a comment marker line immediately above the schedule line; this module renders that two-line block and knows how to find/replace/remove it inside arbitrary crontab text, entirely without I/O so it's unit-testable with plain strings.
Constants
Class methods
The NAME="value" line cron.py's env: yes path writes (decl is always double-quoted, unlike cronvar's raw assignment).
Every environment-variable name currently assigned in the text,
in file order - real cron.py's get_envnames (^\S+= match, the
name being everything before the first '='; no comment
exclusion, so a commented-out #FOO=bar still counts, exactly
like real module), reported as the result's envs field.
Every job name currently marked in the text, in file order -
real cron.py's get_jobnames (lines carrying the "#Ansible: "
marker contribute the text after it), reported as the module
result's jobs field. Unlike CronVar.var_names this reflects
the marker comments, not a parse of the schedule lines.
Renders the entry line itself (schedule + optional user + job), commented out with a leading '#' when disabled.
Renders the 5 schedule fields, or a @special_time shorthand that overrides them (matching Ansible's special_time: reboot/daily/etc).
Finds/replaces/removes the {marker, entry} block for name inside
text. Pass new_line: nil to remove the entry entirely (state:
absent, or a name that simply isn't there yet - a no-op). Returns
{new_text, changed}.
Finds/replaces/removes the ENVIRONMENT-VARIABLE assignment(s) for
name inside text - cron.py's env: yes code path, which differs
from CronVar/cronvar.py's: matching is a plain "^NAME=" line
prefix (not shlex tokens), a NEW variable defaults to the TOP of
the file, and insertafter/insertbefore name the variable to
position against (immediately after/before its first declaring
line). Pass decl: nil to remove (state: absent).
Returns {new_text, changed, missing_insert_target}: the third element is the insertafter/insertbefore variable name when it doesn't exist - real cron.py treats that as a hard failure ("Variable named '%s' not found.") rather than cronvar's silent drop, and nothing is written in that case.