From ee6ed3b3869aa0b84c9c4f732f60dbbe31f414a0 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Thu, 26 Aug 2010 14:56:06 -0700 Subject: switch "save" to use new config output implementation. --- scripts/vyatta-save-config.pl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'scripts/vyatta-save-config.pl') diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl index cebdf96..a9b5779 100755 --- a/scripts/vyatta-save-config.pl +++ b/scripts/vyatta-save-config.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Author: An-Cheng Huang +# Author: Vyatta # Date: 2007 # Description: script to save the configuration @@ -29,7 +29,7 @@ my $bootpath = $etcdir . "/config"; my $save_file = $bootpath . "/config.boot"; my $url_tmp_file = $bootpath . "/config.boot.$$"; -my $set_show_opt = 1; +my $show_default = 1; if ($#ARGV > 1) { print "Usage: save [config_file_name] --no-defaults\n"; exit 1; @@ -41,11 +41,11 @@ if (defined($ARGV[0])) { $save_file = $ARGV[0]; } else { - $set_show_opt = 0; + $show_default = 0; } if (defined($ARGV[1]) && $ARGV[1] eq '--no-defaults') { - $set_show_opt = 0; + $show_default = 0; } } @@ -100,8 +100,15 @@ if ($mode eq 'local') { } select $save; -set_show_all($set_show_opt); -outputActiveConfig(); +my @show_cmd = ('cli-shell-api', 'showCfg', '--show-active-only'); +if ($show_default) { + push @show_cmd, '--show-show-defaults'; +} +open(my $show_fd, '-|', @show_cmd) or die 'Cannot execute config output'; +while (<$show_fd>) { + print; +} +close($show_fd); print $version_str; select STDOUT; -- cgit v1.2.3