You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2016/08/12 18:16:32 UTC

svn commit: r1756199 - /vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm

Author: arkurth
Date: Fri Aug 12 18:16:32 2016
New Revision: 1756199

URL: http://svn.apache.org/viewvc?rev=1756199&view=rev
Log:
VCL-961
Updated Linux.pm::get_network_bridge_info to check if brctl command exists. Fixed bug where it returned 0 if the command was not installed and the caller was expecting a hash reference.

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1756199&r1=1756198&r2=1756199&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Fri Aug 12 18:16:32 2016
@@ -3483,6 +3483,11 @@ sub get_network_bridge_info {
 		return;
 	}
 	
+	# This only gets cached if the brctl command does not exist
+	if (defined($self->{network_bridge_info})) {
+		return $self->{network_bridge_info};
+	}
+	
 	my $computer_name = $self->data->get_computer_short_name();
 	
 	# It's possible that a bridge will have multiple interfaces:
@@ -3494,7 +3499,6 @@ sub get_network_bridge_info {
 	# It's possible to have no interfaces listed:
 	# bridge name     bridge id               STP enabled     interfaces
 	# xbr1            8000.000000000000       no
-
 	
 	my $command = "brctl show";
 	my ($exit_status, $output) = $self->execute($command);
@@ -3502,9 +3506,15 @@ sub get_network_bridge_info {
 		notify($ERRORS{'WARNING'}, 0, "failed to execute command on $computer_name: $command");
 		return;
 	}
+	elsif ($exit_status == 127 || grep(/command not found/i, @$output)) {
+		notify($ERRORS{'DEBUG'}, 0, "network bridge configuration does not exist on $computer_name, brctl is not installed");
+		# Cache an empty hash reference so this command isn't needlessly run multiple times
+		$self->{network_bridge_info} = {};
+		return $self->{network_bridge_info};
+	}
 	elsif ($exit_status ne '0') {
 		notify($ERRORS{'WARNING'}, 0, "failed to retrieve network bridge configuration from $computer_name, exit status: $exit_status, command:\n$command\noutput:\n" . join("\n", @$output));
-		return 0;
+		return;
 	}
 	
 	my $network_bridge_info = {};