[pve-devel] [PATCH manager v3 1/4] Jobs: include existing types in state file regex for deletion
Dominik Csapak
d.csapak at proxmox.com
Tue Jan 17 12:46:56 CET 2023
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 <d.csapak at proxmox.com>
---
PVE/Jobs.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/PVE/Jobs.pm b/PVE/Jobs.pm
index 86ce9f693..70cb48212 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})) {
--
2.30.2
More information about the pve-devel
mailing list