feat: ietf-schedule basic recurrence implementation#1523
Conversation
Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
| @@ -0,0 +1,2 @@ | |||
| # Cron daemon for infix-schedule | |||
| service [S12345] crond -f -- Cron daemon | |||
There was a problem hiding this comment.
Do not start in runlevel S, 2345 should be enough. This since we have seen slow platforms (arm32) struggle with starting to much, when it should focus on confd.
| if (iv <= 0) | ||
| iv = 1; | ||
|
|
||
| if (strstr(freq, "secondly")) { |
There was a problem hiding this comment.
If it not possible to set in cron, it should not be possible to set in YANG, block it in yang model, the problematic here is that it is an identity, do not remember how we did with unsupported identities. Lets discuss this.
We have as a policy that everything should be validated in the yang model (using deviate or must expression, mandatory etc), to keep the c-code as little as possible.
| } | ||
|
|
||
| augment "/sys:system" { | ||
| container schedules { |
| leaf description { | ||
| type string; | ||
| } | ||
| choice action { |
|
|
||
| leaf last-check { | ||
| type yang:date-and-time; | ||
| description |
There was a problem hiding this comment.
For things that pure operational, set as config: false
| "infix-ptp@2026-04-07.yang" | ||
| "ietf-schedule@2026-03-10.yang -e basic-recurrence" | ||
| "infix-schedule@2026-05-27.yang" | ||
| ) |
There was a problem hiding this comment.
In this file you also need to update the reference to all updated yang models, in this case infix-system-software@.....yang
| } | ||
| }) | ||
|
|
||
| with test.step("Verify schedule is configured"): |
There was a problem hiding this comment.
This is redundat, since if the YANG model succeed to apply, it is configured.
| @@ -0,0 +1,108 @@ | |||
| module infix-schedule { | |||
There was a problem hiding this comment.
this file should just be a symlink to infix-schedule.yang, see surrounding files.
| fi | ||
|
|
||
| # Read configured update-url from sysrepo, fall back to upstream | ||
| UPDATE_URL=$(sysrepocfg -d running -f json \ |
There was a problem hiding this comment.
Use jq here instead of calls to misc shell programs, this to limit forking:
like this (This is pure AI, not tested, just to give you a hint what i mean):
UPDATE_URL=$(sysrepocfg -d running -f json \
-x '/ietf-system:system/infix-system:software/check-update/update-url' \
2>/dev/null \
| jq -r '.. | objects | ."update-url"? // empty')
| fi | ||
|
|
||
| # Read configured update-url from sysrepo, fall back to upstream | ||
| UPDATE_URL=$(sysrepocfg -d running -f json \ |
There was a problem hiding this comment.
I think you should look to use the 'copy' shell command instead of sysrepocfg here, since there will be problem calling sysrepocfg for everone except root:
admin@infix-00-00-00:$ sysrepocfg -X -f json -d operational$
[ERR] open() on "/etc/sysrepo/sr_main_lock" failed (Permission denied).
sysrepocfg error: Failed to connect (System function call failed)
admin@infix-00-00-00:
copy also respect nacm if i remember it correctly.
|
Also add the the "magic" key word fix #issue number in the PR description, this closes the open issue automatically when merged. |
Thing is #1301 is formulated in way that it is support for full unattended upgrade, and this PR adds scheduling stuff and just a check for update availiability thus I ommited it from git message, since full implementation of unnattended-upgrade will be handled in a separete merge request. |
Description
Checklist
Tick relevant boxes, this PR is-a or has-a: