]> git.proxmox.com Git - pve-manager.git/blobdiff - PVE/Jobs.pm
api2: network: improve code readability
[pve-manager.git] / PVE / Jobs.pm
index 86ce9f69359f414ce364eeb76b207949a69fd0c7..bd3233323031c4138365ef32ce577d16aa33e9f9 100644 (file)
@@ -7,9 +7,11 @@ use JSON;
 use PVE::Cluster qw(cfs_lock_file cfs_read_file cfs_register_file);
 use PVE::Job::Registry;
 use PVE::Jobs::VZDump;
+use PVE::Jobs::RealmSync;
 use PVE::Tools;
 
 PVE::Jobs::VZDump->register();
+PVE::Jobs::RealmSync->register();
 PVE::Job::Registry->init();
 
 cfs_register_file(
@@ -324,7 +326,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})) {