summaryrefslogtreecommitdiff
path: root/scripts/vyatta-save-config.pl
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-08-26 14:56:06 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-08-26 14:56:06 -0700
commitee6ed3b3869aa0b84c9c4f732f60dbbe31f414a0 (patch)
tree71614d66b1c09b966c4f44456ce1285a17c0351f /scripts/vyatta-save-config.pl
parent80459cf8380301800e4d024a5eb2bc4a63cdd919 (diff)
downloadvyatta-cfg-ee6ed3b3869aa0b84c9c4f732f60dbbe31f414a0.tar.gz
vyatta-cfg-ee6ed3b3869aa0b84c9c4f732f60dbbe31f414a0.zip
switch "save" to use new config output implementation.
Diffstat (limited to 'scripts/vyatta-save-config.pl')
-rwxr-xr-xscripts/vyatta-save-config.pl19
1 files changed, 13 insertions, 6 deletions
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 <ancheng@vyatta.com>
+# Author: Vyatta <eng@vyatta.com>
# 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;