]> git.proxmox.com Git - pve-manager.git/blobdiff - PVE/Jobs.pm
Jobs: include existing types in state file regex for deletion
[pve-manager.git] / PVE / Jobs.pm
index 86ce9f69359f414ce364eeb76b207949a69fd0c7..70cb4821238b870cac8af99206e04d2fcf746a19 100644 (file)
@@ -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})) {