From 599cf3cd9ef97c217b4ee16afabdbdf7fd5469c1 Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Tue, 21 Nov 2023 12:28:04 +0100 Subject: [PATCH] fix: die with right reason when asked to parse an empty snmp walk --- lib/GLPI/Agent/SNMP/Mock.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/GLPI/Agent/SNMP/Mock.pm b/lib/GLPI/Agent/SNMP/Mock.pm index 06a11cc08..b2f8546b6 100644 --- a/lib/GLPI/Agent/SNMP/Mock.pm +++ b/lib/GLPI/Agent/SNMP/Mock.pm @@ -99,7 +99,8 @@ sub reset_original_context { sub _setIndexedValues { my ($self, $file) = @_; - my @lines = getAllLines(file => $file || $self->{_file}); + my @lines = getAllLines(file => $file || $self->{_file}) + or die "No content found in ".($file || $self->{_file})." file\n"; # check first line for safety die "invalid file format\n" unless $lines[0] =~ /^(\S+) = .*/;