Author: fapeeler
Date: Thu Aug 23 19:18:46 2012
New Revision: 1376654
URL: http://svn.apache.org/viewvc?rev=1376654&view=rev
Log:
VCL-621
added check if public ip address is different than stored Ip address call
update routines
Modified:
vcl/trunk/managementnode/lib/VCL/new.pm
Modified: vcl/trunk/managementnode/lib/VCL/new.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/new.pm?rev=1376654&r1=1376653&r2=1376654&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/new.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/new.pm Thu Aug 23 19:18:46 2012
@@ -1282,6 +1282,9 @@ sub confirm_public_ip_address {
my $computer_short_name =
$self->data->get_computer_short_name();
my $public_ip_address;
+ my $computer_ip_address =
$self->data->get_computer_ip_address();
+ my $computer_id = $self->data->get_computer_id();
+ my $computer_short_name =
$self->data->get_computer_short_name();
#Try to get public IP address from OS module
if(!$self->os->can("get_public_ip_address")) {
@@ -1290,6 +1293,19 @@ sub confirm_public_ip_address {
}
elsif ($public_ip_address = $self->os->get_public_ip_address()) {
notify($ERRORS{'DEBUG'}, 0, "retrieved public IP address from
$computer_short_name using the OS module: $public_ip_address");
+
+ # Update the Datastructure and computer table if the
retrieved IP address does not match what is in the database
+ if ($computer_ip_address ne $public_ip_address) {
+ $self->data->set_computer_ip_address($public_ip_address);
+
+ if (update_computer_address($computer_id, $public_ip_address)) {
+ notify($ERRORS{'OK'}, 0, "updated dynamic public IP address in
computer table for $computer_short_name, $public_ip_address");
+ }
+ else {
+ notify($ERRORS{'WARNING'}, 0, "failed to update dynamic public
IP address in computer table for $computer_short_name, $public_ip_address");
+ return 0;
+ }
+ }
}
else {
notify($ERRORS{'WARNING'}, 0, "failed to retrieve dynamic public IP
address from $computer_short_name");