[pbs-devel] applied: [PATCH backup] parse_calendar_event: support the weekly special expression

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jul 21 13:29:01 CEST 2020


While we do not yet support the date specs for CalendarEvent the left
out "weekly" special expression[0] dies not requires that support.
It is specified to be equivalent with `Mon *-*-* 00:00:00` [0] and
this can be implemented with the weekday and time support we already
have.

[0]: https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/tools/systemd/parse_time.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/tools/systemd/parse_time.rs b/src/tools/systemd/parse_time.rs
index b1cbc38..93657b2 100644
--- a/src/tools/systemd/parse_time.rs
+++ b/src/tools/systemd/parse_time.rs
@@ -219,7 +219,16 @@ fn parse_calendar_event_incomplete(mut i: &str) -> IResult<&str, CalendarEvent>
                     ..Default::default()
                 }));
             }
-            "monthly" | "weekly" | "yearly" | "quarterly" | "semiannually" => {
+            "weekly" => {
+                return Ok(("", CalendarEvent {
+                    hour: vec![DateTimeValue::Single(0)],
+                    minute: vec![DateTimeValue::Single(0)],
+                    second: vec![DateTimeValue::Single(0)],
+                    days: WeekDays::MONDAY,
+                    ..Default::default()
+                }));
+            }
+            "monthly" | "yearly" | "quarterly" | "semiannually" => {
                 return Err(parse_error(i, "unimplemented date or time specification"));
             }
             _ => { /* continue */ }
-- 
2.20.1






More information about the pbs-devel mailing list