From 85b9ba88f18c824fba3f96cbcee3060401e56a61 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 8 Nov 2021 14:07:56 +0100 Subject: [PATCH] api/backup: refactor string for all days Signed-off-by: Dominik Csapak --- PVE/API2/Backup.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm index 3b343636..9dc3b48e 100644 --- a/PVE/API2/Backup.pm +++ b/PVE/API2/Backup.pm @@ -17,6 +17,8 @@ use PVE::VZDump::Common; use base qw(PVE::RESTHandler); +use constant ALL_DAYS => 'mon,tue,wed,thu,fri,sat,sun'; + PVE::JSONSchema::register_format('pve-day-of-week', \&verify_day_of_week); sub verify_day_of_week { my ($value, $noerr) = @_; @@ -101,7 +103,7 @@ __PACKAGE__->register_method({ type => 'string', format => 'pve-day-of-week-list', optional => 1, description => "Day of week selection.", - default => 'mon,tue,wed,thu,fri,sat,sun', + default => ALL_DAYS, }, enabled => { type => 'boolean', @@ -129,7 +131,7 @@ __PACKAGE__->register_method({ my $create_job = sub { my $data = cfs_read_file('vzdump.cron'); - $param->{dow} = 'mon,tue,wed,thu,fri,sat,sun' if !defined($param->{dow}); + $param->{dow} = ALL_DAYS if !defined($param->{dow}); $param->{enabled} = 1 if !defined($param->{enabled}); PVE::VZDump::verify_vzdump_parameters($param, 1); -- 2.39.2