From 92b873bd7cddbdd355cff8fa9cbc9baf0496766a Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Wed, 7 Nov 2007 14:37:06 -0800 Subject: allow loading empty config file --- scripts/vyatta-load-config.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index a0b53d5..a6f037a 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -28,8 +28,13 @@ if (!($load_file =~ /^\//)) { print "Loading config file $load_file...\n"; my %cfg_hier = VyattaConfigLoad::loadConfigHierarchy($load_file); if (scalar(keys %cfg_hier) == 0) { - print "Load failed\n"; - exit 1; + print "The specified file does not contain any configuration.\n"; + print "Do you want to remove everything in the running configuration? [no] "; + my $resp = ; + if (!($resp =~ /^yes$/i)) { + print "Configuration not loaded\n"; + exit 1; + } } my %cfg_diff = VyattaConfigLoad::getConfigDiff(\%cfg_hier); -- cgit v1.2.3