From f764ef4014be454e4ecaa3faced18d6daffee8a0 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Fri, 3 Dec 2010 14:44:27 -0800 Subject: Fix 6511: compare perl errors after failed commit. Add check for empty diff before trying to filter it. --- scripts/vyatta-config-mgmt.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'scripts') 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); -- cgit v1.2.3