Author: arkurth
Date: Thu Aug 11 14:37:53 2011
New Revision: 1156635

URL: http://svn.apache.org/viewvc?rev=1156635&view=rev
Log:
VCL-496
Updated DataStructure.pm to implement a set_computer_private_ip_address 
subroutine.

Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=1156635&r1=1156634&r2=1156635&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Thu Aug 11 
14:37:53 2011
@@ -837,7 +837,7 @@ sub _automethod : Automethod {
                # Make sure the value was set in the hash
                my $check_value = eval $hash_path;
                if ($check_value eq $set_data) {
-                       notify($ERRORS{'DEBUG'}, 0, "data structure updated: 
$hash_path\n$data_identifier = $set_data");
+                       #notify($ERRORS{'DEBUG'}, 0, "data structure updated: 
$hash_path\n$data_identifier = $set_data");
                        return sub {1;};
                }
                else {
@@ -1654,6 +1654,40 @@ sub get_computer_private_ip_address {
 
 #/////////////////////////////////////////////////////////////////////////////
 
+=head2 set_computer_private_ip_address
+
+ Parameters  : $private_ip_address
+ Returns     : boolean
+ Description : Sets the computer private IP address in the DataStructure.
+
+=cut
+
+sub set_computer_private_ip_address {
+       my $self = shift;
+       
+       # Check if subroutine was called as an object method
+       unless (ref($self) && $self->isa('VCL::DataStructure')) {
+               notify($ERRORS{'CRITICAL'}, 0, "subroutine can only be called 
as a VCL::DataStructure module object method");
+               return;
+       }
+       
+       my $private_ip_address = shift;
+       if (!$private_ip_address) {
+               notify($ERRORS{'WARNING'}, 0, "computer private IP address 
argument was not supplied");
+               return;
+       }
+       elsif (!is_valid_ip_address($private_ip_address)) {
+               notify($ERRORS{'WARNING'}, 0, "computer private IP address 
argument is not valid: '$private_ip_address'");
+               return;
+       }
+       
+       notify($ERRORS{'DEBUG'}, 0, "updated computer private IP address: 
'$private_ip_address'");
+       
$self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS}
 = $private_ip_address;
+       return 1;
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
 =head2 is_variable_set
 
  Parameters  : variable name


Reply via email to