summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-12-03 14:44:27 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-12-03 14:44:27 -0800
commitf764ef4014be454e4ecaa3faced18d6daffee8a0 (patch)
treead39617a5e866cafced69252acf1cc6036e18b17
parent6008b49e802d7fb9b777cb0ac78b9bf37031b876 (diff)
downloadvyatta-config-mgmt-f764ef4014be454e4ecaa3faced18d6daffee8a0.tar.gz
vyatta-config-mgmt-f764ef4014be454e4ecaa3faced18d6daffee8a0.zip
Fix 6511: compare perl errors after failed commit.
Add check for empty diff before trying to filter it.
-rwxr-xr-xscripts/vyatta-config-mgmt.pl11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/vyatta-config-mgmt.pl b/scripts/vyatta-config-mgmt.pl
index b3acc8d..46017e0 100755
--- a/scripts/vyatta-config-mgmt.pl
+++ b/scripts/vyatta-config-mgmt.pl
@@ -278,9 +278,14 @@ if ($action eq 'diff') {
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 $tmp_config_file $tmp_config_file2`;
- $diff = filter_file_lines($diff);
- print "$diff\n";
- system("rm $tmp_config_file $tmp_config_file2");
+ if (defined $diff and length($diff) > 0) {
+ $diff = filter_file_lines($diff);
+ print "$diff\n";
+ system("rm $tmp_config_file $tmp_config_file2");
+ } else {
+ print "No changes between working and active configurations\n";
+ exit 0;
+ }
} elsif ($args eq 0) {
my $rev1 = $ARGV[0];
check_valid_rev($rev1);