TT#17650 Do not consider undef result from YAML::XS functions an error

These functions do internal error checks and will die on their own.
They return undef whenever the YAML file is empty, so we should not
abort on those.

Change-Id: Ifd61b98d3a95ee9b15ff240fbd5db0c1029c98e3
changes/22/13922/9
Guillem Jover 9 years ago
parent 0174cd7ec9
commit d127610c17

@ -100,7 +100,7 @@ if (lc($action) eq "off")
else
{
copy($file, $file.".orig") or die "Copy failed: $ERRNO" unless(-e $file.".orig");
$yaml = LoadFile($file) or die "File $file could not be read";
$yaml = LoadFile($file);
$yaml->{kamailio}{lb}{cfgt} = 'yes';
$yaml->{kamailio}{lb}{use_dns_cache} = 'off';
$yaml->{kamailio}{proxy}{children} = 1;
@ -113,8 +113,7 @@ else
if ( -e $group_yml_file )
{
print "load $group_yml_file config file\n";
my $group_yml = LoadFile($group_yml_file) or
die "File $group_yml_file could not be read";
my $group_yml = LoadFile($group_yml_file);
my $hm = Hash::Merge->new('RIGHT_PRECEDENT');
my $config = {};
$config = $hm->merge( $config, $yaml);
@ -139,7 +138,7 @@ else
}
untie @array;
}
DumpFile($file, $yaml) or die "Could not write YAML to $file";
DumpFile($file, $yaml);
}
#EOF

@ -4,4 +4,4 @@ soundsets:
sounds:
unauth_caller_ip:
filename: sounds/no_sh.wav
loopplay: false
loopplay: 'false'

Loading…
Cancel
Save