From a1c51a74ca5326541e8bdfd154ca1e137689f37c Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 17 Jan 2023 12:46:56 +0100 Subject: [PATCH] Jobs: include existing types in state file regex for deletion otherwise, we cannot correctly match types that contain a hyphen, since the id itself can also contain those. creating a regex where the first part is the concrete allowed types followed by a hyphen + id can also match those. Signed-off-by: Dominik Csapak Signed-off-by: Thomas Lamprecht --- PVE/Jobs.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PVE/Jobs.pm b/PVE/Jobs.pm index 86ce9f69..70cb4821 100644 --- a/PVE/Jobs.pm +++ b/PVE/Jobs.pm @@ -324,7 +324,10 @@ sub synchronize_job_states_with_config { } } - PVE::Tools::dir_glob_foreach($state_dir, '(.*?)-(.*).json', sub { + my $valid_types = PVE::Job::Registry->lookup_types(); + my $type_regex = join("|", $valid_types->@*); + + PVE::Tools::dir_glob_foreach($state_dir, "(${type_regex})-(.*).json", sub { my ($path, $type, $id) = @_; if (!defined($data->{ids}->{$id})) {