diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2010-11-19 18:06:18 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2010-11-19 18:06:18 -0800 |
commit | b08fad72dc5091b6ec40fc1de918157b75a1550a (patch) | |
tree | 8384c833a21376234ac57a6c5d8882a891dd017d | |
parent | 94c541435d033a6508ec19e3d08b7934a441f4e4 (diff) | |
download | vyatta-config-mgmt-b08fad72dc5091b6ec40fc1de918157b75a1550a.tar.gz vyatta-config-mgmt-b08fad72dc5091b6ec40fc1de918157b75a1550a.zip |
Check sessionChanged before creating active/working config files.
-rwxr-xr-x | scripts/vyatta-config-mgmt.pl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/vyatta-config-mgmt.pl b/scripts/vyatta-config-mgmt.pl index 440371a..4516f79 100755 --- a/scripts/vyatta-config-mgmt.pl +++ b/scripts/vyatta-config-mgmt.pl @@ -234,16 +234,17 @@ if ($action eq 'diff') { print "diff\n" if $debug; my $args = $#ARGV; if ($args < 0) { + my $rc = system("cli-shell-api sessionChanged"); + if (defined $rc and $rc > 0) { + print "No changes between working and active configurations\n"; + exit 0; + } my $tmp_config_file = "/tmp/config.boot.$$"; my $tmp_config_file2 = "/tmp/config.boot2.$$"; system("cli-shell-api showCfg --show-active-only > $tmp_config_file"); system("cli-shell-api showCfg --show-working-only > $tmp_config_file2"); my $diff = `diff -u -w $tmp_config_file $tmp_config_file2`; - if (defined $diff and length($diff) > 0) { - print $diff; - } else { - print "No changes between working and active configurations\n"; - } + print $diff; system("rm $tmp_config_file $tmp_config_file2"); } elsif ($args eq 0) { my $rev1 = $ARGV[0]; |