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.csa...@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to