From a17d3c9ef4f2693fb05db603f2594278b3f8ffad Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Wed, 5 Feb 2014 14:01:08 +0100 Subject: [PATCH] MT#5887 copy the original config.yml file and restore it after the tests. --- bin/config_debug.pl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bin/config_debug.pl b/bin/config_debug.pl index 4445c625..f88a5117 100755 --- a/bin/config_debug.pl +++ b/bin/config_debug.pl @@ -19,6 +19,7 @@ # Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". # use File::Spec; +use File::Copy; use Tie::File; use strict; use warnings; @@ -59,8 +60,6 @@ else $base_dir = '/usr/share/kamailio-config-tests'; } -$yaml = YAML::Tiny->read($file) or die "File $file could not be read"; - my ($action, $domain) = @ARGV; $action = 'off' unless defined($action); @@ -68,13 +67,7 @@ $domain = 'spce.test' unless defined($domain); if (lc($action) eq "off") { - $yaml->[0]->{kamailio}{lb}{debug} = 'no'; - $yaml->[0]->{kamailio}{lb}{use_dns_cache} = 'on'; - $yaml->[0]->{kamailio}{proxy}{debug} = 'no'; - $yaml->[0]->{kamailio}{proxy}{presence}{enable} = 'no'; - $yaml->[0]->{sems}{debug} = 'no'; - $yaml->[0]->{checktools}{sip_check_enable} = 1; - + move($file.".orig", $file); tie @array, 'Tie::File', '/etc/hosts' or die ('Can set test domain on /etc/hosts'); for (@array) { @@ -94,6 +87,8 @@ if (lc($action) eq "off") } else { + copy($file, $file.".orig") or die "Copy failed: $!"; + $yaml = YAML::Tiny->read($file) or die "File $file could not be read"; $yaml->[0]->{kamailio}{lb}{debug} = 'yes'; $yaml->[0]->{kamailio}{lb}{use_dns_cache} = 'off'; $yaml->[0]->{kamailio}{proxy}{debug} = 'yes';