From da73f98b4dddf4b2168258e505af18839d003e2c Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Mon, 29 Nov 2010 18:14:49 -0800 Subject: Fix 6362: "show configuration cmds" actually returns set commands for saved config.boot instead of running config --- scripts/vyatta-config-gen-sets.pl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-config-gen-sets.pl b/scripts/vyatta-config-gen-sets.pl index be30477..1863edd 100755 --- a/scripts/vyatta-config-gen-sets.pl +++ b/scripts/vyatta-config-gen-sets.pl @@ -27,9 +27,15 @@ use strict; use lib "/opt/vyatta/share/perl5/"; use Vyatta::ConfigLoad; -my $conf_file = '/opt/vyatta/etc/config/config.boot'; - -$conf_file = $ARGV[0] if defined $ARGV[0]; +my $conf_file; +my $conf_tmp = "/tmp/config.boot.$$"; + +if (defined $ARGV[0]) { + $conf_file = $ARGV[0]; +} else { + system("cli-shell-api showCfg --show-active-only > $conf_tmp"); + $conf_file = $conf_tmp; +} # get a list of all config statement in the startup config file my %cfg_hier = Vyatta::ConfigLoad::getStartupConfigStatements($conf_file); @@ -49,7 +55,8 @@ foreach (@all_nodes) { my $cmd = "set $path " . @$path_ref[($elements - 1)]; print "$cmd\n"; } -print "commit\n"; + +system("rm -f $conf_tmp") if $conf_file eq $conf_tmp; exit 0; -- cgit v1.2.3