From 26c880b074e3b3819f4d77467aa35c028f3a06c5 Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Tue, 17 Dec 2024 20:08:16 +0100 Subject: [PATCH] fix: Load toolbox yaml if not loaded when checked for toolbox enabled jobs --- lib/GLPI/Agent/HTTP/Server/ToolBox.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/GLPI/Agent/HTTP/Server/ToolBox.pm b/lib/GLPI/Agent/HTTP/Server/ToolBox.pm index afb4288db..bcd3ee8a3 100644 --- a/lib/GLPI/Agent/HTTP/Server/ToolBox.pm +++ b/lib/GLPI/Agent/HTTP/Server/ToolBox.pm @@ -494,15 +494,15 @@ sub read_yaml { sub reload_yaml_on_change { my ($self) = @_; - return unless $self->{_yaml_loaded_time}; - - my $reload_needed = 0; - foreach my $file (keys(%{$self->{_yaml_loaded_time}})) { - my $mtime = stat($file)->mtime; - if ($mtime > $self->{_yaml_loaded_time}->{$file}) { - $reload_needed++; - $self->debug("Reloading YAML files on $file update"); - last; + my $reload_needed = $self->{_yaml_loaded_time} ? 0 : 1; + unless ($reload_needed) { + foreach my $file (keys(%{$self->{_yaml_loaded_time}})) { + my $mtime = stat($file)->mtime; + if ($mtime > $self->{_yaml_loaded_time}->{$file}) { + $reload_needed++; + $self->debug("Reloading YAML files on $file update"); + last; + } } }