Merge branch 'apache:develop' into perl-5.26
diff --git a/.gitignore b/.gitignore
index 0bd6167..7fd5dc7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.idea
+.vscode
*.kpf
diff --git a/managementnode/bin/install_perl_libs.pl b/managementnode/bin/install_perl_libs.pl
index c57ffb6..e7188d8 100755
--- a/managementnode/bin/install_perl_libs.pl
+++ b/managementnode/bin/install_perl_libs.pl
@@ -55,55 +55,43 @@
'make',
'nmap',
'openssl-devel',
- 'perl-Archive-Tar',
+ 'bzip2',
'perl-CPAN',
- 'perl-Crypt-CBC',
- 'perl-Crypt-OpenSSL-RSA',
- 'perl-Crypt-Rijndael',
+ 'perl-App-cpanminus',
'perl-DBD-MySQL',
- 'perl-DBI',
- 'perl-Digest-SHA1',
- 'perl-Expect',
- 'perl-Frontier-RPC',
- 'perl-Frontier-RPC-Client',
- 'perl-IO-String',
- 'perl-JSON',
- 'perl-LWP-Protocol-https',
- 'perl-MailTools',
- 'perl-Mo',
- 'perl-Net-Jabber',
- 'perl-Net-Netmask',
- 'perl-Net-SSH-Expect',
- 'perl-Object-InsideOut',
- 'perl-RPC-XML',
- 'perl-Scalar-List-Utils',
- 'perl-Text-CSV_XS',
- 'perl-Time-HiRes',
- 'perl-XML-Simple',
- 'perl-YAML',
'xmlsec1-openssl',
- 'perl-Frontier-RPC',
- 'perl-Frontier-RPC-Client',
- 'perl-LWP-Protocol-https',
- 'perl-Mo',
- 'perl-Object-InsideOut',
- 'perl-Scalar-List-Utils',
- 'perl-Expect',
);
my @PERL_MODULES = (
- 'CPAN',
- 'Crypt::CBC',
- 'Digest::SHA1',
+ 'CPAN@2.36',
+ 'Archive::Tar@3.02',
+ 'Crypt::CBC@3.04',
+ 'Crypt::OpenSSL::RSA@0.33',
+ 'Crypt::Rijndael@1.16',
+ 'DBI@1.643',
+ 'Digest::SHA1@2.13',
+ 'Expect@1.35',
+ 'Frontier::RPC2',
'Frontier::Client',
- 'IO::String',
- 'LWP::Protocol::https',
- 'Mo::builder',
- 'Net::Ping::External',
- 'Net::SSH::Expect',
- 'Object::InsideOut',
- 'Scalar::Util',
- 'Text::CSV_XS',
+ 'IO::String@1.08',
+ 'JSON@4.10',
+ 'Net::LDAP@0.68',
+ 'LWP::Protocol::https@6.12',
+ 'MailTools@2.21',
+ 'Mo@0.40',
+ 'Mo::builder@0.40',
+ 'Net::Jabber@2.0',
+ 'Net::Netmask@2.0002',
+ 'Net::SSH::Expect@1.09',
+ 'Net::Ping::External@0.15',
+ 'Object::InsideOut@4.05',
+ 'REST::Client@281',
+ 'RPC::XML@1.61',
+ 'Sub::Util@1.63',
+ 'Text::CSV_XS@1.53',
+ 'Time::HiRes@1.9764',
+ 'XML::Simple@2.25',
+ 'YAML@1.31'
);
# Store the command line options in hash
@@ -418,35 +406,31 @@
PERL_MODULE: for my $perl_module (@PERL_MODULES) {
print_break('*');
- my $cpan_version = get_perl_module_cpan_version($perl_module);
- if (!$cpan_version) {
+ #my $cpan_version = get_perl_module_cpan_version($perl_module);
+ my ($pModule, $cpan_version ) = split(/@/, $perl_module);
+ if (!defined $cpan_version) {
+ $cpan_version = 'undef';
+ }
+ my $cpan_version_available = `cpanm --info -q $perl_module | grep -i failed | wc -l`;
+ #if (!$cpan_version) {
+ if ($cpan_version_available == 1) {
print "ERROR: unable to install $perl_module Perl module, information could not be obtained from CPAN\n";
$ERRORS->{'Perl module'}{$perl_module} = 1;
next PERL_MODULE;
}
# Check if installed version matches what is available from CPAN
- my $installed_version = get_perl_module_installed_version($perl_module);
+ my $installed_version = get_perl_module_installed_version($pModule);
if ($installed_version && $installed_version eq $cpan_version) {
print "$perl_module Perl module is up to date\n";
}
else {
-
- # Check if the CPAN module implements the "notest" method
- # This is not available in older versions of CPAN.pm
- if (CPAN::Shell->can('notest')) {
- print "Attempting to install (notest, force) Perl module using CPAN: $perl_module\n";
- eval { CPAN::Shell->rematein("notest", "force", "install", $perl_module) };
- #eval { CPAN::Shell->notest("force install", $perl_module) };
- }
- else {
- print "Attempting to install (force) Perl module using CPAN: $perl_module\n";
- eval { CPAN::Shell->rematein("force", "install", $perl_module) };
- #eval { CPAN::Shell->force("install", $perl_module) };
- }
+
+ print "Attempting to install Perl module using CPANMinus: $perl_module\n";
+ my $returnval = system("cpanm", "--notest", "--force", $perl_module);
# Check if the module was successfully installed
- $installed_version = get_perl_module_installed_version($perl_module);
+ $installed_version = get_perl_module_installed_version($pModule);
if (!$installed_version) {
print "ERROR: failed to install $perl_module Perl module\n";
$ERRORS->{'Perl module'}{$perl_module} = 1;
@@ -455,7 +439,7 @@
}
# Check if corresponding Linux package failed - remove from %ERRORS
- my $linux_package_name = "perl-$perl_module";
+ my $linux_package_name = "perl-$pModule";
$linux_package_name =~ s/::/-/g;
if (defined $ERRORS->{'Linux package'}{$linux_package_name}) {
print "Removed $linux_package_name from list of failed Linux packages\n";
diff --git a/managementnode/bin/vcld b/managementnode/bin/vcld
index 2dd919c..6893f32 100755
--- a/managementnode/bin/vcld
+++ b/managementnode/bin/vcld
@@ -129,7 +129,7 @@
my $management_node_hostname = $info{managementnode}{hostname};
# Set environment variables for global management node information
- $ENV{management_node_id} = $management_node_id;
+ $ENV->{management_node_id} = $management_node_id;
notify($ERRORS{'DEBUG'}, $LOGFILE, "management_node_id environment variable set: $management_node_id");
# Get the management node checkin interval from the database if defined
@@ -143,23 +143,23 @@
#===========================================================================
while (1) {
- delete $ENV{request_id};
- delete $ENV{reservation_id};
- delete $ENV{state};
- delete $ENV{data};
+ delete $ENV->{request_id};
+ delete $ENV->{reservation_id};
+ delete $ENV->{state};
+ delete $ENV->{data};
# Web site inserts into variable table whenever an admin or user message is modified
# Check if the variable exists, if so, validate all of the messages
check_messages_need_validating();
- my $data_age_seconds = (time - $ENV{management_node_info}{$management_node_id}{RETRIEVAL_TIME});
+ my $data_age_seconds = (time - $ENV->{management_node_info}->{$management_node_id}->{RETRIEVAL_TIME});
if ($data_age_seconds > 120 ) {
notify($ERRORS{'DEBUG'}, $LOGFILE, "retrieving management node info for '$management_node_id', cached data is stale: $data_age_seconds seconds old");
$info{managementnode} = get_management_node_info();
if (defined $info{managementnode}{checkininterval}) {
$management_node_checkin_interval = $info{managementnode}{checkininterval};
}
- #notify($ERRORS{'DEBUG'}, $LOGFILE, "dump: " . format_data($ENV{management_node_info}{$management_node_id}));
+ #notify($ERRORS{'DEBUG'}, $LOGFILE, "dump: " . format_data($ENV->{management_node_info}->{$management_node_id}));
}
# Set the vcld environment variable to 0 so other subroutines know if this is the vcld or child process
@@ -215,9 +215,9 @@
my @reservation_ids = sort { $a <=> $b } keys %{$info{request}{$request_id}{reservation}};
my $reservation_count = @reservation_ids;
- $ENV{request_id} = $request_id;
- $ENV{reservation_id} = 0;
- $ENV{state} = $request_state_name;
+ $ENV->{request_id} = $request_id;
+ $ENV->{reservation_id} = 0;
+ $ENV->{state} = $request_state_name;
# Make sure the request state is valid
if ($request_state_name !~ /inuse|reserved|deleted|timeout|reclaim|reload|new|tomaintenance|image|imageprep|makeproduction|imageinuse|complete|failed|pending|maintenance|tovmhostinuse|rebootsoft|reboothard|reinstall|servermodified|checkpoint|test/) {
@@ -235,10 +235,10 @@
#===========================================================================
# Loop through the reservations associated with this request
RESERVATION: foreach my $reservation_id (@reservation_ids) {
- $ENV{reservation_id} = $reservation_id;
- $ENV{database_select_count} = 0;
- $ENV{database_execute_count} = 0;
- $ENV{database_select_calls} = {};
+ $ENV->{reservation_id} = $reservation_id;
+ $ENV->{database_select_count} = 0;
+ $ENV->{database_execute_count} = 0;
+ $ENV->{database_select_calls} = {};
my $reservation_info = $info{request}{$request_id}{reservation}{$reservation_id};
my $reservation_management_node_id = $reservation_info->{managementnodeid};
@@ -338,7 +338,7 @@
}
# Add the DataStructure reference to %ENV so it can be accessed from non-object methods
- $ENV{data} = $data_structure;
+ $ENV->{data} = $data_structure;
# Remove any existing 'exited' computerloadlog entries
delete_computerloadlog_reservation($reservation_id, 'exited');
@@ -354,10 +354,10 @@
} ## end foreach my $reservation_id (keys %{$info{request...
} ## end foreach my $request_id (keys %{$info{request}})
- delete $ENV{request_id};
- delete $ENV{reservation_id};
- delete $ENV{state};
- delete $ENV{data};
+ delete $ENV->{request_id};
+ delete $ENV->{reservation_id};
+ delete $ENV->{state};
+ delete $ENV->{data};
#===========================================================================
# Get all the block requests assigned to this management node
@@ -571,10 +571,10 @@
notify($ERRORS{'DEBUG'}, $LOGFILE, "vcld environment variable set to $ENV{vcld} for this process");
# Set the request_id and reservation_id environment variables
- $ENV{request_id} = $request_id;
- $ENV{reservation_id} = $reservation_id if $reservation_id;
- $ENV{state} = $state;
- $ENV{data} = $data_structure;
+ $ENV->{request_id} = $request_id;
+ $ENV->{reservation_id} = $reservation_id if $reservation_id;
+ $ENV->{state} = $state;
+ $ENV->{data} = $data_structure;
# Rename this process to include some request info
rename_vcld_process($data_structure);
@@ -671,8 +671,8 @@
notify($ERRORS{'CRITICAL'}, $LOGFILE, "@_");
# Prevent requests stuck in pending, try to set state back to original
- if ($ENV{request_id} && $ENV{state}) {
- update_request_state($ENV{request_id}, $ENV{state}, $ENV{state});
+ if ($ENV->{request_id} && $ENV->{state}) {
+ update_request_state($ENV->{request_id}, $ENV->{state}, $ENV->{state});
}
# Reinstall the signal handler in case of unreliable signals
@@ -941,7 +941,7 @@
# Set the setup_path environment variable to anonymous array containing 'vcld'
# This is used to display the location in the menu hierarchy
# strings added/removed to the array cause the location to change
- $ENV{setup_path} = ['vcld'];
+ $ENV->{setup_path} = ['vcld'];
setup_print_break();
my $choice = setup_get_menu_choice(\%setup_menu);
@@ -958,14 +958,14 @@
my $choice_sub_ref = $choice->{sub_ref};
my $choice_parent_menu_names = $choice->{parent_menu_names};
- push @{$ENV{setup_path}}, @$choice_parent_menu_names, $choice_name;
+ push @{$ENV->{setup_path}}, @$choice_parent_menu_names, $choice_name;
my $package_name = get_code_ref_package_name($choice_sub_ref);
my $subroutine_name = get_code_ref_subroutine_name($choice_sub_ref);
my $module_object = $setup_module_objects{$package_name}{object};
&$choice_sub_ref($module_object);
- pop @{$ENV{setup_path}};
+ pop @{$ENV->{setup_path}};
}
setup_print_break('=');
diff --git a/managementnode/lib/VCL/DataStructure.pm b/managementnode/lib/VCL/DataStructure.pm
index 558c09f..c981bd4 100644
--- a/managementnode/lib/VCL/DataStructure.pm
+++ b/managementnode/lib/VCL/DataStructure.pm
@@ -483,38 +483,38 @@
$SUBROUTINE_MAPPINGS{user_use_public_keys} = '$self->request_data->{user}{usepublickeys}';
$SUBROUTINE_MAPPINGS{user_ssh_public_keys} = '$self->request_data->{user}{sshpublickeys}';
-$SUBROUTINE_MAPPINGS{management_node_id} = '$ENV{management_node_info}{id}';
-$SUBROUTINE_MAPPINGS{management_node_ipaddress} = '$ENV{management_node_info}{IPaddress}';
-$SUBROUTINE_MAPPINGS{management_node_hostname} = '$ENV{management_node_info}{hostname}';
-$SUBROUTINE_MAPPINGS{management_node_ownerid} = '$ENV{management_node_info}{ownerid}';
-$SUBROUTINE_MAPPINGS{management_node_stateid} = '$ENV{management_node_info}{stateid}';
-$SUBROUTINE_MAPPINGS{management_node_lastcheckin} = '$ENV{management_node_info}{lastcheckin}';
-$SUBROUTINE_MAPPINGS{management_node_checkininterval} = '$ENV{management_node_info}{checkininterval}';
-$SUBROUTINE_MAPPINGS{management_node_install_path} = '$ENV{management_node_info}{installpath}';
-$SUBROUTINE_MAPPINGS{management_node_image_lib_enable} = '$ENV{management_node_info}{imagelibenable}';
-$SUBROUTINE_MAPPINGS{management_node_image_lib_group_id} = '$ENV{management_node_info}{imagelibgroupid}';
-$SUBROUTINE_MAPPINGS{management_node_image_lib_user} = '$ENV{management_node_info}{imagelibuser}';
-$SUBROUTINE_MAPPINGS{management_node_image_lib_key} = '$ENV{management_node_info}{imagelibkey}';
-$SUBROUTINE_MAPPINGS{management_node_keys} = '$ENV{management_node_info}{keys}';
-$SUBROUTINE_MAPPINGS{management_node_image_lib_partners} = '$ENV{management_node_info}{IMAGELIBPARTNERS}';
-$SUBROUTINE_MAPPINGS{management_node_short_name} = '$ENV{management_node_info}{SHORTNAME}';
-$SUBROUTINE_MAPPINGS{management_node_state_name} = '$ENV{management_node_info}{state}{name}';
-$SUBROUTINE_MAPPINGS{management_node_os_name} = '$ENV{management_node_info}{OSNAME}';
-$SUBROUTINE_MAPPINGS{management_node_predictive_module_id} = '$ENV{management_node_info}{predictivemoduleid}';
-$SUBROUTINE_MAPPINGS{management_node_ssh_port} = '$ENV{management_node_info}{sshport}';
+$SUBROUTINE_MAPPINGS{management_node_id} = '$ENV->{management_node_info}->{id}';
+$SUBROUTINE_MAPPINGS{management_node_ipaddress} = '$ENV->{management_node_info}->{IPaddress}';
+$SUBROUTINE_MAPPINGS{management_node_hostname} = '$ENV->{management_node_info}->{hostname}';
+$SUBROUTINE_MAPPINGS{management_node_ownerid} = '$ENV->{management_node_info}->{ownerid}';
+$SUBROUTINE_MAPPINGS{management_node_stateid} = '$ENV->{management_node_info}->{stateid}';
+$SUBROUTINE_MAPPINGS{management_node_lastcheckin} = '$ENV->{management_node_info}->{lastcheckin}';
+$SUBROUTINE_MAPPINGS{management_node_checkininterval} = '$ENV->{management_node_info}->{checkininterval}';
+$SUBROUTINE_MAPPINGS{management_node_install_path} = '$ENV->{management_node_info}->{installpath}';
+$SUBROUTINE_MAPPINGS{management_node_image_lib_enable} = '$ENV->{management_node_info}->{imagelibenable}';
+$SUBROUTINE_MAPPINGS{management_node_image_lib_group_id} = '$ENV->{management_node_info}->{imagelibgroupid}';
+$SUBROUTINE_MAPPINGS{management_node_image_lib_user} = '$ENV->{management_node_info}->{imagelibuser}';
+$SUBROUTINE_MAPPINGS{management_node_image_lib_key} = '$ENV->{management_node_info}->{imagelibkey}';
+$SUBROUTINE_MAPPINGS{management_node_keys} = '$ENV->{management_node_info}->{keys}';
+$SUBROUTINE_MAPPINGS{management_node_image_lib_partners} = '$ENV->{management_node_info}->{IMAGELIBPARTNERS}';
+$SUBROUTINE_MAPPINGS{management_node_short_name} = '$ENV->{management_node_info}->{SHORTNAME}';
+$SUBROUTINE_MAPPINGS{management_node_state_name} = '$ENV->{management_node_info}->{state}->{name}';
+$SUBROUTINE_MAPPINGS{management_node_os_name} = '$ENV->{management_node_info}->{OSNAME}';
+$SUBROUTINE_MAPPINGS{management_node_predictive_module_id} = '$ENV->{management_node_info}->{predictivemoduleid}';
+$SUBROUTINE_MAPPINGS{management_node_ssh_port} = '$ENV->{management_node_info}->{sshport}';
-$SUBROUTINE_MAPPINGS{management_node_public_ip_configuration} = '$ENV{management_node_info}{PUBLIC_IP_CONFIGURATION}';
-$SUBROUTINE_MAPPINGS{management_node_public_subnet_mask} = '$ENV{management_node_info}{PUBLIC_SUBNET_MASK}';
+$SUBROUTINE_MAPPINGS{management_node_public_ip_configuration} = '$ENV->{management_node_info}->{PUBLIC_IP_CONFIGURATION}';
+$SUBROUTINE_MAPPINGS{management_node_public_subnet_mask} = '$ENV->{management_node_info}->{PUBLIC_SUBNET_MASK}';
#$SUBROUTINE_MAPPINGS{management_node_public_default_gateway} = '$ENV{management_node_info}{PUBLIC_DEFAULT_GATEWAY}';
-$SUBROUTINE_MAPPINGS{management_node_public_dns_server} = '$ENV{management_node_info}{PUBLIC_DNS_SERVER}';
+$SUBROUTINE_MAPPINGS{management_node_public_dns_server} = '$ENV->{management_node_info}->{PUBLIC_DNS_SERVER}';
-$SUBROUTINE_MAPPINGS{management_node_sysadmin_email} = '$ENV{management_node_info}{SYSADMIN_EMAIL}';
-$SUBROUTINE_MAPPINGS{management_node_shared_email_box} = '$ENV{management_node_info}{SHARED_EMAIL_BOX}';
+$SUBROUTINE_MAPPINGS{management_node_sysadmin_email} = '$ENV->{management_node_info}->{SYSADMIN_EMAIL}';
+$SUBROUTINE_MAPPINGS{management_node_shared_email_box} = '$ENV->{management_node_info}->{SHARED_EMAIL_BOX}';
-$SUBROUTINE_MAPPINGS{management_node_predictive_module_name} = '$ENV{management_node_info}{predictive_name}';
-$SUBROUTINE_MAPPINGS{management_node_predictive_module_pretty_name} = '$ENV{management_node_info}{predictive_prettyname}';
-$SUBROUTINE_MAPPINGS{management_node_predictive_module_description} = '$ENV{management_node_info}{predictive_description}';
-$SUBROUTINE_MAPPINGS{management_node_predictive_module_perl_package} = '$ENV{management_node_info}{predictive_perlpackage}';
+$SUBROUTINE_MAPPINGS{management_node_predictive_module_name} = '$ENV->{management_node_info}->{predictive_name}';
+$SUBROUTINE_MAPPINGS{management_node_predictive_module_pretty_name} = '$ENV->{management_node_info}->{predictive_prettyname}';
+$SUBROUTINE_MAPPINGS{management_node_predictive_module_description} = '$ENV->{management_node_info}->{predictive_description}';
+$SUBROUTINE_MAPPINGS{management_node_predictive_module_perl_package} = '$ENV->{management_node_info}->{predictive_perlpackage}';
$SUBROUTINE_MAPPINGS{subroutine_mappings} = '\%SUBROUTINE_MAPPINGS';
@@ -889,14 +889,14 @@
return sub { };
}
- # The normal reservation management node data is stored in $ENV{management_node_info}{<identifier>}
+ # The normal reservation management node data is stored in $ENV->{management_node_info}->{<identifier>}
# We don't want to overwrite this, but want to temporarily store the data retrieved
# This allows the $hash_path mechanism to work without alterations
# Temporarily overwrite this data by using 'local', and set it to the data just retrieved
- # Once the current scope is exited, $ENV{management_node_info} will return to its original value
- local $ENV{management_node_info} = $management_node_info_retrieved;
+ # Once the current scope is exited, $ENV->{management_node_info} will return to its original value
+ local $ENV->{management_node_info} = $management_node_info_retrieved;
- # Attempt to retrieve the value from the temporary data: $ENV{management_node_info}{KEY}
+ # Attempt to retrieve the value from the temporary data: $ENV->{management_node_info}->{KEY}
$return_value = eval $hash_path;
}
elsif (!$key_defined) {
@@ -1438,7 +1438,7 @@
my $self = shift;
my $request_data = format_data($self->request_data, 'request');
- my $management_node_info = format_data($ENV{management_node_info}, 'management_node');
+ my $management_node_info = format_data($ENV->{management_node_info}, 'management_node');
notify($ERRORS{'OK'}, 0, "request data:\n$request_data\n\nmanagement node info:\n$management_node_info");
}
@@ -1460,7 +1460,7 @@
foreach my $mapping_key (sort keys %SUBROUTINE_MAPPINGS) {
my $mapping_value = $SUBROUTINE_MAPPINGS{$mapping_key};
$mapping_value =~ s/^\$self->request_data->/\%request/;
- $mapping_value =~ s/^\$ENV{management_node_info}/\%management_node/;
+ $mapping_value =~ s/^\$ENV\{management_node_info\}/\%management_node/;
$output .= "get_$mapping_key() : $mapping_value\n";
}
@@ -1573,7 +1573,7 @@
# Check if the IP address is already stored
my $data_structure_private_ip_address = $self->request_data->{reservation}{$self->reservation_id}{computer}{privateIPaddress};
- my $env_private_ip_address = $ENV{computer_private_ip_address}{$computer_id};
+ my $env_private_ip_address = $ENV->{computer_private_ip_address}->{$computer_id};
# Check if private IP adddress is stored in %ENV and differs from this object's data
if ($data_structure_private_ip_address) {
diff --git a/managementnode/lib/VCL/Module.pm b/managementnode/lib/VCL/Module.pm
index ea750fe..477d560 100644
--- a/managementnode/lib/VCL/Module.pm
+++ b/managementnode/lib/VCL/Module.pm
@@ -1007,14 +1007,14 @@
$display_warning = 1;
}
- if (!$ENV{mn_os}) {
+ if (!$ENV->{mn_os}) {
if ($display_warning) {
- notify($ERRORS{'WARNING'}, 0, "unable to return management node OS object, \$ENV{mn_os} is not set");
+ notify($ERRORS{'WARNING'}, 0, "unable to return management node OS object, \$ENV->{mn_os} is not set");
}
return;
}
else {
- return $ENV{mn_os};
+ return $ENV->{mn_os};
}
}
@@ -1175,7 +1175,7 @@
my $type = ref($self);
my $mn_os_address = sprintf('%x', $mn_os);
notify($ERRORS{'DEBUG'}, 0, "storing reference to managment node OS object (address: $mn_os_address) in this $type object (address: $address)");
- $ENV{mn_os} = $mn_os;
+ $ENV->{mn_os} = $mn_os;
return 1;
}
@@ -2275,26 +2275,26 @@
}
- if (!$ENV{rpc_xml_error}) {
+ if (!$ENV->{rpc_xml_error}) {
print "FAILURE: RPC-XML access is not configured correctly, view the log file for more information: $LOGFILE\n";
return 0;
}
- print "FAILURE: RPC-XML access is not configured correctly, error message:\n$ENV{rpc_xml_error}\n\n";
+ print "FAILURE: RPC-XML access is not configured correctly, error message:\n$ENV->{rpc_xml_error}\n\n";
- if ($ENV{rpc_xml_error} =~ /access denied/i) {
+ if ($ENV->{rpc_xml_error} =~ /access denied/i) {
# Affiliation not correct
# Affiliation not included, default affiliation isn't Local
# Incorrect password
print "SUGGESTION: make sure the xmlrpc_username and xmlrpc_pass values are correct in $CONF_FILE_PATH\n";
}
- if ($ENV{rpc_xml_error} =~ /internal server error/i) {
+ if ($ENV->{rpc_xml_error} =~ /internal server error/i) {
# Affiliation not included in username
# User doesn't exist but affiliation does
# Affiliation does not exist
print "SUGGESTION: make sure the xmlrpc_username is correct in $CONF_FILE_PATH, current value: '$XMLRPC_USER'\n";
}
- if ($ENV{rpc_xml_error} =~ /internal error while processing/i) {
+ if ($ENV->{rpc_xml_error} =~ /internal error while processing/i) {
# Affiliation not included in username
# User doesn't exist but affiliation does
# Affiliation does not exist
diff --git a/managementnode/lib/VCL/Module/OS.pm b/managementnode/lib/VCL/Module/OS.pm
index fb0d6ec..b5747eb 100644
--- a/managementnode/lib/VCL/Module/OS.pm
+++ b/managementnode/lib/VCL/Module/OS.pm
@@ -53,7 +53,8 @@
use diagnostics;
use English '-no_match_vars';
use File::Temp qw(tempdir);
-use POSIX qw(tmpnam);
+#use POSIX qw(tmpnam);
+use File::Temp qw/ :POSIX /;
use Net::SSH::Expect;
use List::Util qw(min max);
@@ -3243,7 +3244,7 @@
}
# TESTING: use the new subroutine if $ENV{execute_new} is set and the command isn't one that's known to fail with the new subroutine
- if ($ENV{execute_new} && !$no_persistent_connection) {
+ if ($ENV->{execute_new} && !$no_persistent_connection) {
my @excluded_commands = $command =~ /(vmkfstools|qemu-img|Convert-VHD|scp|shutdown|reboot)/i;
if (@excluded_commands) {
notify($ERRORS{'DEBUG'}, 0, "not using execute_new, command: $command\nexcluded commands matched:\n" . join("\n", @excluded_commands));
@@ -3433,7 +3434,7 @@
if ($attempt > 0) {
$attempt_string = "attempt $attempt/$max_attempts: ";
$ssh->close() if $ssh;
- delete $ENV{net_ssh_expect}{$remote_connection_target};
+ delete $ENV->{net_ssh_expect}->{$remote_connection_target};
notify($ERRORS{'DEBUG'}, 0, $attempt_string . "sleeping for $attempt_delay seconds before making next attempt");
sleep $attempt_delay;
@@ -3446,7 +3447,7 @@
# Use a flag to determine if null should be returned without making another attempt
my $return_null;
- if (!$ENV{net_ssh_expect}{$remote_connection_target}) {
+ if (!$ENV->{net_ssh_expect}->{$remote_connection_target}) {
eval {
my $expect_options = {
host => $remote_connection_target,
@@ -3516,11 +3517,11 @@
}
}
else {
- $ssh = $ENV{net_ssh_expect}{$remote_connection_target};
+ $ssh = $ENV->{net_ssh_expect}->{$remote_connection_target};
# Delete the stored SSH object to make sure it isn't saved if the command fails
# The SSH object will be added back to %ENV if the command completes successfully
- delete $ENV{net_ssh_expect}{$remote_connection_target};
+ delete $ENV->{net_ssh_expect}->{$remote_connection_target};
}
# Set the timeout
@@ -3576,7 +3577,7 @@
notify($ERRORS{'OK'}, 0, "executed command on $computer_string: '$command', exit status: $exit_status, output:\n$output") if ($display_output);
# Save the SSH object for later use
- $ENV{net_ssh_expect}{$remote_connection_target} = $ssh;
+ $ENV->{net_ssh_expect}->{$remote_connection_target} = $ssh;
return ($exit_status, \@output_lines);
}
diff --git a/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm b/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm
index eb28b48..d93c38d 100644
--- a/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm
+++ b/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm
@@ -1546,7 +1546,7 @@
my ($table_name) = @_;
$table_name = 'filter' unless $table_name;
- $ENV{iptables_get_table_info_count}{$table_name}++;
+ $ENV->{iptables_get_table_info_count}->{$table_name}++;
my $computer_name = $self->data->get_computer_hostname();
@@ -2675,9 +2675,9 @@
my $address = sprintf('%x', $self);
my $table_count_string;
- if ($ENV{iptables_get_table_info_count}) {
- for my $table_name (keys %{$ENV{iptables_get_table_info_count}}) {
- my $table_count = $ENV{iptables_get_table_info_count}{$table_name};
+ if ($ENV->{iptables_get_table_info_count}) {
+ for my $table_name (keys %{$ENV->{iptables_get_table_info_count}}) {
+ my $table_count = $ENV->{iptables_get_table_info_count}->{$table_name};
$table_count_string .= "$table_name: $table_count\n";
}
notify($ERRORS{'DEBUG'}, 0, "get_table_info calls ($address):\n$table_count_string");
diff --git a/managementnode/lib/VCL/Module/OS/Windows.pm b/managementnode/lib/VCL/Module/OS/Windows.pm
index d612447..f65c241 100644
--- a/managementnode/lib/VCL/Module/OS/Windows.pm
+++ b/managementnode/lib/VCL/Module/OS/Windows.pm
@@ -10645,10 +10645,10 @@
'Delete Product Key',
);
- my @setup_path = @{$ENV{setup_path}};
+ my @setup_path = @{$ENV->{setup_path}};
OPERATION: while (1) {
- @{$ENV{setup_path}} = @setup_path;
+ @{$ENV->{setup_path}} = @setup_path;
print '-' x 76 . "\n";
@@ -10658,7 +10658,7 @@
my $operation_name = $operation_choices[$operation_choice_index];
print "\n";
- push @{$ENV{setup_path}}, $operation_name;
+ push @{$ENV->{setup_path}}, $operation_name;
if ($operation_name =~ /list/i) {
$self->setup_display_product_key_info();
@@ -10858,10 +10858,10 @@
);
- my @setup_path = @{$ENV{setup_path}};
+ my @setup_path = @{$ENV->{setup_path}};
OPERATION: while (1) {
- @{$ENV{setup_path}} = @setup_path;
+ @{$ENV->{setup_path}} = @setup_path;
print '-' x 76 . "\n";
print "Choose an operation:\n";
@@ -10870,7 +10870,7 @@
my $operation_name = $operation_choices[$operation_choice_index];
print "\n";
- push @{$ENV{setup_path}}, $operation_name;
+ push @{$ENV->{setup_path}}, $operation_name;
if ($operation_name =~ /list/i) {
$self->setup_display_kms_server_info();
diff --git a/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm b/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
index 8604168..8a93f17 100644
--- a/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
+++ b/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
@@ -53,7 +53,8 @@
use File::Basename;
use IO::File;
-use POSIX qw(tmpnam);
+#use POSIX qw(tmpnam);
+use File::Temp qw/ :POSIX /;
###############################################################################
@@ -404,7 +405,7 @@
# [Unattended] - Setup/Sysprep execution configuration
$sysprep_inf_hash{Unattended}{DriverSigningPolicy} = 'Ignore'; # Specifies how to process unsigned drivers during unattended Setup
- $sysprep_inf_hash{Unattended}{ExtendOemPartition} = 'No'; # Specifies whether to extend the partition on which you install the Microsoft® Windows® operating system
+ $sysprep_inf_hash{Unattended}{ExtendOemPartition} = 'No'; # Specifies whether to extend the partition on which you install the Microsoft� Windows� operating system
#$sysprep_inf_hash{Unattended}{Hibernation} = 'No'; # Specifies whether to enable the hibernation option in the Power Options control panel
$sysprep_inf_hash{Unattended}{InstallFilesPath} = 'C:\Sysprep\i386'; # Specifies the location of files necessary for installation during Mini-Setup
#$sysprep_inf_hash{Unattended}{KeepPageFile} = ''; # Specifies whether to regenerate the page file
@@ -484,8 +485,8 @@
# [UserData] - user identification settings
$sysprep_inf_hash{UserData}{ComputerName} = '*'; # Specifies the computer name
- $sysprep_inf_hash{UserData}{FullName} = 'Virtual Computing Lab'; # Specifies the end users full name
- $sysprep_inf_hash{UserData}{OrgName} = $image_affiliation_name; # Specifies an organizations name
+ $sysprep_inf_hash{UserData}{FullName} = 'Virtual Computing Lab'; # Specifies the end user�s full name
+ $sysprep_inf_hash{UserData}{OrgName} = $image_affiliation_name; # Specifies an organization�s name
$sysprep_inf_hash{UserData}{ProductKey} = $product_key; # Specifies the Product Key for each unique installation of Windows
# [Sysprep] section contains an entry for automatically generating the entries in the pre-existing [SysprepMassStorage] section and then installing those mass-storage controllers
diff --git a/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm b/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
index bf0f3d0..19ecd18 100644
--- a/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
@@ -3690,7 +3690,7 @@
return;
}
- return $ENV{firewall_ruleset_info} if defined($ENV{firewall_ruleset_info});
+ return $ENV->{firewall_ruleset_info} if defined($ENV->{firewall_ruleset_info});
my $vmhost_computer_name = $self->data->get_vmhost_hostname();
@@ -3801,7 +3801,7 @@
}
notify($ERRORS{'OK'}, 0, "retrieved firewall ruleset info from VM host $vmhost_computer_name:\n" . format_data($ruleset_info));
- $ENV{firewall_ruleset_info} = $ruleset_info;
+ $ENV->{firewall_ruleset_info} = $ruleset_info;
return $ruleset_info;
}
diff --git a/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm b/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
index c19807c..a20dd37 100644
--- a/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
@@ -8177,7 +8177,7 @@
}
# Parse the file contents, add ' --- vcl.tgz' to the end of the 'modules=' line if it hasn't already been added
- # modules=k.z s.z c.z oem.tgz license.tgz m.z state.tgz vcl.tgz
+ # modules=k.z � s.z � c.z � oem.tgz � license.tgz � m.z � state.tgz � vcl.tgz
my $updated_bootbank_cfg_contents;
my $bootbank_cfg_changed = 0;
for my $line (@bootbank_cfg_contents) {
@@ -8361,7 +8361,7 @@
#my $vmhost_id = 32;
my $vmhost_computer_name = $management_node_vmhost_info->{$vmhost_id}{computer}{SHORTNAME};
- push @{$ENV{setup_path}}, $vmhost_computer_name;
+ push @{$ENV->{setup_path}}, $vmhost_computer_name;
# Get a provisioning object to control the VM host
diff --git a/managementnode/lib/VCL/Module/Provisioning/docker.pm b/managementnode/lib/VCL/Module/Provisioning/docker.pm
index b8e380b..0e03ea0 100644
--- a/managementnode/lib/VCL/Module/Provisioning/docker.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/docker.pm
@@ -116,7 +116,7 @@
# set the specific ssh port for vmhost in the variable table. e.g., 24
notify($ERRORS{'OK'}, 0, "remote_connection_target: $remote_connection_target");
my $target_ssh_port = get_variable("vmhost_ssh_port") || 22;
- $ENV{ssh_port}{$remote_connection_target} = $target_ssh_port;
+ $ENV->{ssh_port}->{$remote_connection_target} = $target_ssh_port;
notify($ERRORS{'OK'}, 0, "vmhost_ssh_port: $target_ssh_port");
# create a useragent
@@ -514,7 +514,7 @@
my $remote_connection_target = determine_remote_connection_target($vmhost_name);
# set the specific ssh port for vmhost in the variable table. e.g., 24
my $target_ssh_port = get_variable("vmhost_ssh_port") || 22;
- $ENV{ssh_port}{$remote_connection_target} = $target_ssh_port;
+ $ENV->{ssh_port}->{$remote_connection_target} = $target_ssh_port;
# create a useragent
my $ua = LWP::UserAgent->new();
diff --git a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
index 3808e45..c7c4dd1 100644
--- a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
@@ -1967,7 +1967,7 @@
# add nic for public, first check for project not including 'vcl', skipping the public network assigned to the vmhost profile
my $skipadditionalnicnetwork = '';
if ($image_project !~ /vcl/i) {
- foreach my $network_name (keys $network_info) {
+ foreach my $network_name (keys %{$network_info}) {
next if ($network_name =~ /^$eth0_source_device$/i || $network_name =~ /^$eth1_source_device$/i);
if ($network_name =~ /$image_project/i || $image_project =~ /$network_name/i) {
$skipadditionalnicnetwork = $network_name;
@@ -2012,7 +2012,7 @@
# add additional nics if project not strictly 'vcl'
if ($image_project !~ /^vcl$/i) {
notify($ERRORS{'DEBUG'}, 0, "image project is: $image_project, checking if additional network adapters should be configured");
- foreach my $network_name (keys $network_info) {
+ foreach my $network_name (keys %{$network_info}) {
next if ($network_name =~ /^$eth0_source_device$/i || $network_name =~ /^$eth1_source_device$/i);
next if ($network_name eq $skipadditionalnicnetwork);
if ($network_name =~ /$image_project/i || $image_project =~ /$network_name/i) {
diff --git a/managementnode/lib/VCL/Module/Provisioning/openstack.pm b/managementnode/lib/VCL/Module/Provisioning/openstack.pm
index b2d2ffc..9074d7d 100644
--- a/managementnode/lib/VCL/Module/Provisioning/openstack.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/openstack.pm
@@ -296,7 +296,7 @@
my $imagerevision_id = $self->data->get_imagerevision_id() || return 0;
my $image_name = $self->data->get_image_name() || return 0;
my ($os_token, $os_compute_url) = $self->_get_os_token_compute_url();
- my $os_project_id = $ENV{'OS_PROJECT_ID'};
+ my $os_project_id = $ENV->{'OS_PROJECT_ID'};
if (!defined($os_token) || !defined($os_compute_url) || !defined($os_project_id)) {
notify($ERRORS{'WARNING'}, 0, "failed to get openstack auth info");
return 0;
@@ -360,7 +360,7 @@
my $image_name = shift;
my $imagerevision_id = $self->data->get_imagerevision_id() || return;
my ($os_token, $os_compute_url) = $self->_get_os_token_compute_url();
- my $os_project_id = $ENV{'OS_PROJECT_ID'};
+ my $os_project_id = $ENV->{'OS_PROJECT_ID'};
if (!defined($os_token) || !defined($os_compute_url) || !defined($os_project_id)) {
notify($ERRORS{'WARNING'}, 0, "failed to get openstack auth info");
return;
@@ -788,11 +788,11 @@
sub _get_os_token_compute_url {
my $self = shift;
- my $os_auth_url = $ENV{'OS_AUTH_URL'};
- my $os_tenant_name = $ENV{'OS_TENANT_NAME'};
- my $os_user_name = $ENV{'OS_USERNAME'};
- my $os_user_password = $ENV{'OS_PASSWORD'};
- my $os_service_name = $ENV{'OS_SERVICE_NAME'};
+ my $os_auth_url = $ENV->{'OS_AUTH_URL'};
+ my $os_tenant_name = $ENV->{'OS_TENANT_NAME'};
+ my $os_user_name = $ENV->{'OS_USERNAME'};
+ my $os_user_password = $ENV->{'OS_PASSWORD'};
+ my $os_service_name = $ENV->{'OS_SERVICE_NAME'};
if (!defined($os_auth_url) || !defined($os_tenant_name)
|| !defined($os_user_name) || !defined($os_user_password) || !defined($os_service_name)) {
notify($ERRORS{'WARNING'}, 0, "failed to get openstack auth information from environment");
@@ -880,7 +880,7 @@
return 0;
}
my ($os_token, $os_compute_url) = $self->_get_os_token_compute_url();
- my $os_project_id = $ENV{'OS_PROJECT_ID'};
+ my $os_project_id = $ENV->{'OS_PROJECT_ID'};
if (!defined($os_token) || !defined($os_compute_url) || !defined($os_project_id)) {
notify($ERRORS{'WARNING'}, 0, "failed to get the openstack auth info");
return 0;
@@ -1007,7 +1007,7 @@
}
notify($ERRORS{'DEBUG'}, 0, "os_image_name: $image_name in sub _post_os_create_image");
my ($os_token, $os_compute_url) = $self->_get_os_token_compute_url();
- my $os_project_id = $ENV{'OS_PROJECT_ID'};
+ my $os_project_id = $ENV->{'OS_PROJECT_ID'};
if (!defined($os_token) || !defined($os_compute_url) || !defined($os_project_id)) {
notify($ERRORS{'WARNING'}, 0, "failed to get openstack auth information from environment");
return;
@@ -1076,18 +1076,18 @@
my $imagerevision_id = $self->data->get_imagerevision_id() || return;
my $computer_name = $self->data->get_computer_short_name() || return;
my $image_os_type = $self->data->get_image_os_type() || return;
- my $os_project_id = $ENV{'OS_PROJECT_ID'};
- my $os_key_name = $ENV{'VCL_LINUX_KEY'};
+ my $os_project_id = $ENV->{'OS_PROJECT_ID'};
+ my $os_key_name = $ENV->{'VCL_LINUX_KEY'};
if (!defined($os_project_id) || !defined($os_key_name)) {
notify($ERRORS{'WARNING'}, 0, "failed to get the openstack project id or key name");
return;
}
if ($image_os_type eq 'linux') {
- $os_key_name = $ENV{'VCL_LINUX_KEY'};
+ $os_key_name = $ENV->{'VCL_LINUX_KEY'};
notify($ERRORS{'OK'}, 0, "The $os_key_name is the key for Linux (default)");
}
elsif ($image_os_type eq 'windows') {
- $os_key_name = $ENV{'VCL_WINDOWS_KEY'};
+ $os_key_name = $ENV->{'VCL_WINDOWS_KEY'};
notify($ERRORS{'OK'}, 0, "The $os_key_name is the key for Windows");
}
@@ -1230,14 +1230,14 @@
my $vcl_linux_key = $self->{config}->{vcl_linux_key};
# Set Environment File
- $ENV{'OS_AUTH_URL'} = $os_auth_url;
- $ENV{'OS_SERVICE_NAME'} = $os_service_name;
- $ENV{'OS_PROJECT_ID'} = $os_project_id;
- $ENV{'OS_TENANT_NAME'} = $os_tenant_name;
- $ENV{'OS_USERNAME'} = $os_username;
- $ENV{'OS_PASSWORD'} = $os_password;
- $ENV{'VCL_WINDOWS_KEY'} = $vcl_windows_key;
- $ENV{'VCL_LINUX_KEY'} = $vcl_linux_key;
+ $ENV->{'OS_AUTH_URL'} = $os_auth_url;
+ $ENV->{'OS_SERVICE_NAME'} = $os_service_name;
+ $ENV->{'OS_PROJECT_ID'} = $os_project_id;
+ $ENV->{'OS_TENANT_NAME'} = $os_tenant_name;
+ $ENV->{'OS_USERNAME'} = $os_username;
+ $ENV->{'OS_PASSWORD'} = $os_password;
+ $ENV->{'VCL_WINDOWS_KEY'} = $vcl_windows_key;
+ $ENV->{'VCL_LINUX_KEY'} = $vcl_linux_key;
return 1;
}# end sub _set_os_auth_conf
@@ -1258,7 +1258,7 @@
my $computer_name = $self->data->get_computer_short_name() || return 0;
my ($os_token, $os_compute_url) = $self->_get_os_token_compute_url();
- my $os_project_id = $ENV{'OS_PROJECT_ID'};
+ my $os_project_id = $ENV->{'OS_PROJECT_ID'};
my $os_instance_id = $self->_get_os_instance_id();
if (!defined($os_token) || !defined($os_compute_url) || !defined($os_project_id) || !defined($os_instance_id)) {
notify($ERRORS{'WARNING'}, 0, "failed to get the openstack auth info");
@@ -1360,7 +1360,7 @@
my $os_image_id = shift;
my ($os_token, $os_compute_url) = $self->_get_os_token_compute_url();
- my $os_project_id = $ENV{'OS_PROJECT_ID'};
+ my $os_project_id = $ENV->{'OS_PROJECT_ID'};
if (!defined($os_image_id) || !defined($os_token) || !defined($os_compute_url) || !defined($os_project_id)) {
notify($ERRORS{'WARNING'}, 0, "failed to get openstack auth info or image id: $os_image_id");
return 0;
diff --git a/managementnode/lib/VCL/Module/Provisioning/xCAT.pm b/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
index 1b06029..20f6fdd 100644
--- a/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
@@ -106,10 +106,10 @@
my $self = shift;
# Check the XCAT_ROOT environment variable, it should be defined
- if (defined($ENV{XCATROOT}) && $ENV{XCATROOT}) {
- $XCAT_ROOT = $ENV{XCATROOT};
+ if (defined($ENV->{XCATROOT}) && $ENV->{XCATROOT}) {
+ $XCAT_ROOT = $ENV->{XCATROOT};
}
- elsif (defined($ENV{XCATROOT})) {
+ elsif (defined($ENV->{XCATROOT})) {
notify($ERRORS{'OK'}, 0, "XCATROOT environment variable is not defined, using /opt/xcat");
$XCAT_ROOT = '/opt/xcat';
}
diff --git a/managementnode/lib/VCL/Module/State.pm b/managementnode/lib/VCL/Module/State.pm
index 24dd539..0272387 100644
--- a/managementnode/lib/VCL/Module/State.pm
+++ b/managementnode/lib/VCL/Module/State.pm
@@ -97,11 +97,11 @@
my $nathost_id = $self->data->get_nathost_id(0);
# Initialize the database handle count
- $ENV{dbh_count} = 0;
+ $ENV->{dbh_count} = 0;
# Attempt to get a database handle
- if ($ENV{dbh} = getnewdbh()) {
- notify($ERRORS{'DEBUG'}, 0, "obtained a database handle for this state process, stored as \$ENV{dbh}");
+ if ($ENV->{dbh} = getnewdbh()) {
+ notify($ERRORS{'DEBUG'}, 0, "obtained a database handle for this state process, stored as \$ENV->{dbh}");
}
else {
notify($ERRORS{'CRITICAL'}, 0, "unable to obtain a database handle for this state process");
@@ -876,7 +876,7 @@
}
# Set flag to avoid this subroutine from being called more than once
- $ENV{state_exit} = 1;
+ $ENV->{state_exit} = 1;
my ($request_state_name_new, $computer_state_name_new, $request_log_ending) = @_;
notify($ERRORS{'DEBUG'}, 0, "beginning state module exit tasks, " .
@@ -1096,7 +1096,7 @@
# Check if normal module object data is available
if ($calling_sub && $self && $self->data(0) && !$self->data->is_blockrequest()) {
- if (!$ENV{state_exit}) {
+ if (!$ENV->{state_exit}) {
my $request_id = $self->data->get_request_id();
my @reservation_ids = $self->data->get_reservation_ids();
if (@reservation_ids && $request_id) {
@@ -1111,29 +1111,29 @@
# Uncomment to enable database metrics
# Print the number of database handles this process created for testing/development
- #if (defined $ENV{dbh_count}) {
- # notify($ERRORS{'DEBUG'}, 0, "number of database handles state process created: $ENV{dbh_count}");
+ #if (defined $ENV->{dbh_count}) {
+ # notify($ERRORS{'DEBUG'}, 0, "number of database handles state process created: $ENV->{dbh_count}");
#}
- #if (defined $ENV{database_select_count}) {
- # notify($ERRORS{'DEBUG'}, 0, "database select queries: $ENV{database_select_count}");
+ #if (defined $ENV->{database_select_count}) {
+ # notify($ERRORS{'DEBUG'}, 0, "database select queries: $ENV->{database_select_count}");
#}
- #if (defined $ENV{database_select_calls}) {
+ #if (defined $ENV->{database_select_calls}) {
# my $database_select_calls_string;
- # my %hash = %{$ENV{database_select_calls}};
+ # my %hash = %{$ENV->{database_select_calls}};
# my @sorted_keys = sort { $hash{$b} <=> $hash{$a} } keys(%hash);
# for my $key (@sorted_keys) {
- # $database_select_calls_string .= "$ENV{database_select_calls}{$key}: $key\n";
+ # $database_select_calls_string .= "$ENV->{database_select_calls}{$key}: $key\n";
# }
# notify($ERRORS{'DEBUG'}, 0, "database select called from:\n$database_select_calls_string");
#}
- #if (defined $ENV{database_execute_count}) {
- # notify($ERRORS{'DEBUG'}, 0, "database execute queries: $ENV{database_execute_count}");
+ #if (defined $ENV->{database_execute_count}) {
+ # notify($ERRORS{'DEBUG'}, 0, "database execute queries: $ENV->{database_execute_count}");
#}
# Close the database handle
- if (defined $ENV{dbh}) {
- if (!$ENV{dbh}->disconnect) {
- notify($ERRORS{'WARNING'}, 0, "\$ENV{dbh}: database disconnect failed, " . DBI::errstr());
+ if (defined $ENV->{dbh}) {
+ if (!$ENV->{dbh}->disconnect) {
+ notify($ERRORS{'WARNING'}, 0, "\$ENV->{dbh}: database disconnect failed, " . DBI::errstr());
}
}
diff --git a/managementnode/lib/VCL/blockrequest.pm b/managementnode/lib/VCL/blockrequest.pm
index 6849f9a..a4f362d 100644
--- a/managementnode/lib/VCL/blockrequest.pm
+++ b/managementnode/lib/VCL/blockrequest.pm
@@ -78,11 +78,11 @@
my $self = shift;
# Initialize the database handle count
- $ENV{dbh_count} = 0;
+ $ENV->{dbh_count} = 0;
# Attempt to get a database handle
- if ($ENV{dbh} = getnewdbh()) {
- notify($ERRORS{'OK'}, 0, "obtained a database handle for this state process, stored as \$ENV{dbh}");
+ if ($ENV->{dbh} = getnewdbh()) {
+ notify($ERRORS{'OK'}, 0, "obtained a database handle for this state process, stored as \$ENV->{dbh}");
}
else {
notify($ERRORS{'WARNING'}, 0, "unable to obtain a database handle for this state process");
diff --git a/managementnode/lib/VCL/utils.pm b/managementnode/lib/VCL/utils.pm
index de3e8d7..430c41e 100644
--- a/managementnode/lib/VCL/utils.pm
+++ b/managementnode/lib/VCL/utils.pm
@@ -509,7 +509,7 @@
elsif (!defined($EXECUTE_NEW)) {
$EXECUTE_NEW = 0;
}
- $ENV{execute_new} = $EXECUTE_NEW if $EXECUTE_NEW;
+ $ENV->{execute_new} = $EXECUTE_NEW if $EXECUTE_NEW;
# Set boolean variables to 0 or 1, they may be set to 'no' or 'yes' in the conf file
for ($MYSQL_SSL, $JABBER, $VERBOSE, $DAEMON_MODE, $SETUP_MODE) {
@@ -673,11 +673,11 @@
# Assemble the process identifier string
my $process_identifier;
$process_identifier .= "|$PID|";
- $process_identifier .= $ENV{request_id} if defined $ENV{request_id};
+ $process_identifier .= $ENV->{request_id} if defined $ENV->{request_id};
$process_identifier .= "|";
- $process_identifier .= $ENV{reservation_id} if defined $ENV{reservation_id};
+ $process_identifier .= $ENV->{reservation_id} if defined $ENV->{reservation_id};
$process_identifier .= "|";
- $process_identifier .= $ENV{state} || 'vcld';
+ $process_identifier .= $ENV->{state} || 'vcld';
$process_identifier .= "|$filename:$sub|$line";
# Assemble the log message
@@ -732,8 +732,8 @@
END
# Add the reservation info to the message if the DataStructure object is defined in %ENV
- if ($ENV{data}) {
- my $reservation_info_string = $ENV{data}->get_reservation_info_string();
+ if ($ENV->{data}) {
+ my $reservation_info_string = $ENV->{data}->get_reservation_info_string();
if ($reservation_info_string) {
$reservation_info_string =~ s/\s+$//;
$body .= "$reservation_info_string\n";
@@ -755,27 +755,27 @@
my $subject = "PROBLEM -- $management_node_short_name|";
# Assemble the process identifier string
- if (defined $ENV{request_id} && defined $ENV{reservation_id} && defined $ENV{state}) {
- $subject .= "$ENV{request_id}:$ENV{reservation_id}|$ENV{state}|$filename";
+ if (defined $ENV->{request_id} && defined $ENV->{reservation_id} && defined $ENV->{state}) {
+ $subject .= "$ENV->{request_id}:$ENV->{reservation_id}|$ENV->{state}|$filename";
}
else {
$subject .= "$caller_info";
}
- if (defined($ENV{data})) {
- my $blockrequest_name = $ENV{data}->get_blockrequest_name(0);
+ if (defined($ENV->{data})) {
+ my $blockrequest_name = $ENV->{data}->get_blockrequest_name(0);
$subject .= "|$blockrequest_name" if (defined $blockrequest_name);
- my $computer_name = $ENV{data}->get_computer_short_name(0);
+ my $computer_name = $ENV->{data}->get_computer_short_name(0);
$subject .= "|$computer_name" if (defined $computer_name);
- my $vmhost_hostname = $ENV{data}->get_vmhost_short_name(0);
+ my $vmhost_hostname = $ENV->{data}->get_vmhost_short_name(0);
$subject .= ">$vmhost_hostname" if (defined $vmhost_hostname);
- my $image_name = $ENV{data}->get_image_name(0);
+ my $image_name = $ENV->{data}->get_image_name(0);
$subject .= "|$image_name" if (defined $image_name);
- my $user_name = $ENV{data}->get_user_login_id(0);
+ my $user_name = $ENV->{data}->get_user_login_id(0);
$subject .= "|$user_name" if (defined $user_name);
}
@@ -1200,7 +1200,7 @@
else {
# End time is more than 10 minutes in the future
if ($serverrequest) {
- my $server_inuse_check_time = ($ENV{management_node_info}->{SERVER_INUSE_CHECK} * -1);
+ my $server_inuse_check_time = ($ENV->{management_node_info}->{SERVER_INUSE_CHECK} * -1);
if ($lastcheck_diff_minutes <= $server_inuse_check_time) {
return "poll";
}
@@ -1209,7 +1209,7 @@
}
}
elsif ($reservation_cnt > 1) {
- my $cluster_inuse_check_time = ($ENV{management_node_info}->{CLUSTER_INUSE_CHECK} * -1);;
+ my $cluster_inuse_check_time = ($ENV->{management_node_info}->{CLUSTER_INUSE_CHECK} * -1);;
if ($lastcheck_diff_minutes <= $cluster_inuse_check_time) {
return "poll";
}
@@ -1219,7 +1219,7 @@
}
else {
#notify($ERRORS{'DEBUG'}, 0, "reservation will end in more than 10 minutes ($end_diff_minutes)");
- my $general_inuse_check_time = ($ENV{management_node_info}->{GENERAL_INUSE_CHECK} * -1);
+ my $general_inuse_check_time = ($ENV->{management_node_info}->{GENERAL_INUSE_CHECK} * -1);
if ($lastcheck_diff_minutes <= $general_inuse_check_time) {
notify($ERRORS{'DEBUG'}, 0, "reservation was last checked more than $general_inuse_check_time minutes ago ($lastcheck_diff_minutes), returning 'poll'");
return "poll";
@@ -2182,19 +2182,19 @@
my $dbh;
# Try to use the existing database handle
- if ($ENV{dbh} && $ENV{dbh}->ping && $ENV{dbh}->{Name} =~ /^$database:/) {
+ if ($ENV->{dbh} && $ENV->{dbh}->ping && $ENV->{dbh}->{Name} =~ /^$database:/) {
#notify($ERRORS{'DEBUG'}, 0, "using database handle stored in \$ENV{dbh}");
- return $ENV{dbh};
+ return $ENV->{dbh};
}
- elsif ($ENV{dbh} && $ENV{dbh}->ping) {
- my ($stored_database_name) = $ENV{dbh}->{Name} =~ /^([^:]*)/;
- notify($ERRORS{'DEBUG'}, 0, "database requested ($database) does not match handle stored in \$ENV{dbh} (" . $ENV{dbh}->{Name} . ")");
+ elsif ($ENV->{dbh} && $ENV->{dbh}->ping) {
+ my ($stored_database_name) = $ENV->{dbh}->{Name} =~ /^([^:]*)/;
+ notify($ERRORS{'DEBUG'}, 0, "database requested ($database) does not match handle stored in \$ENV->{dbh} (" . $ENV->{dbh}->{Name} . ")");
}
- elsif (defined $ENV{dbh}) {
- notify($ERRORS{'DEBUG'}, 0, "unable to use database handle stored in \$ENV{dbh}");
+ elsif (defined $ENV->{dbh}) {
+ notify($ERRORS{'DEBUG'}, 0, "unable to use database handle stored in \$ENV->{dbh}");
}
else {
- #notify($ERRORS{'DEBUG'}, 0, "\$ENV{dbh} is not defined, creating new database handle");
+ #notify($ERRORS{'DEBUG'}, 0, "\$ENV->{dbh} is not defined, creating new database handle");
}
my $attempt = 0;
@@ -2223,7 +2223,7 @@
if ($dbh && $dbh->ping) {
# Set InactiveDestroy = 1 for all dbh's belonging to child processes
# Set InactiveDestroy = 0 for all dbh's belonging to vcld
- if (!defined $ENV{vcld} || !$ENV{vcld}) {
+ if (!defined $ENV->{vcld} || !$ENV->{vcld}) {
$dbh->{InactiveDestroy} = 1;
}
else {
@@ -2232,14 +2232,14 @@
# Increment the dbh count environment variable if it is defined
# This is only for development and testing to see how many handles a process creates
- $ENV{dbh_count}++ if defined($ENV{dbh_count});
+ $ENV->{dbh_count}++ if defined($ENV->{dbh_count});
# Store the newly created database handle in an environment variable
# Only store it if $ENV{dbh} is already defined
# It's up to other modules to determine if $ENV{dbh} is defined, they must initialize it
- if (defined $ENV{dbh}) {
- $ENV{dbh} = $dbh;
- notify($ERRORS{'DEBUG'}, 0, "database handle stored in \$ENV{dbh}");
+ if (defined $ENV->{dbh}) {
+ $ENV->{dbh} = $dbh;
+ notify($ERRORS{'DEBUG'}, 0, "database handle stored in \$ENV->{dbh}");
}
return $dbh;
@@ -2304,7 +2304,7 @@
my $command = "/var/root/VCL/oamessage \"$message\"";
- if (run_ssh_command($node, $ENV{management_node_info}{keys}, $command)) {
+ if (run_ssh_command($node, $ENV->{management_node_info}->{keys}, $command)) {
notify($ERRORS{'OK'}, 0, "successfully sent message to OSX user $user on $node");
return 1;
}
@@ -2329,10 +2329,10 @@
my ($password_length, $include_special_characters) = @_;
if (!$password_length) {
- $password_length = $ENV{management_node_info}{USER_PASSWORD_LENGTH} || 8;
+ $password_length = $ENV->{management_node_info}->{USER_PASSWORD_LENGTH} || 8;
}
if (!defined($include_special_characters)) {
- $include_special_characters = $ENV{management_node_info}{INCLUDE_SPECIAL_CHARS};
+ $include_special_characters = $ENV->{management_node_info}->{INCLUDE_SPECIAL_CHARS};
}
#Skip certain confusing chars like: iI1lL,0Oo Zz2
@@ -2596,17 +2596,17 @@
my $calling_sub = (caller(1))[3] || 'undefined';
# Initialize the database_select_calls element if not already initialized
- if (!ref($ENV{database_select_calls})) {
- $ENV{database_select_calls} = {};
+ if (!ref($ENV->{database_select_calls})) {
+ $ENV->{database_select_calls} = {};
}
# For performance tuning - count the number of calls
- $ENV{database_select_count}++;
- if (!defined($ENV{database_select_calls}{$calling_sub})) {
- $ENV{database_select_calls}{$calling_sub} = 1;
+ $ENV->{database_select_count}++;
+ if (!defined($ENV->{database_select_calls}->{$calling_sub})) {
+ $ENV->{database_select_calls}->{$calling_sub} = 1;
}
else {
- $ENV{database_select_calls}{$calling_sub}++;
+ $ENV->{database_select_calls}->{$calling_sub}++;
}
$database = $DATABASE unless $database;
@@ -2627,7 +2627,7 @@
# Check the select statement handle
if (!$select_handle) {
notify($ERRORS{'WARNING'}, 0, "could not prepare select statement, $select_statement, " . $dbh->errstr());
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
return ();
}
@@ -2641,7 +2641,7 @@
"error: " . $dbh->errstr()
);
$select_handle->finish;
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
return ();
}
@@ -2649,7 +2649,7 @@
# An array reference is created containing hash refs because {} is passed to fetchall_arrayref
my @return_rows = @{$select_handle->fetchall_arrayref({})};
$select_handle->finish;
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
return @return_rows;
} ## end sub database_select
@@ -2668,7 +2668,7 @@
sub database_execute {
my ($sql_statement, $database) = @_;
- $ENV{database_execute_count}++;
+ $ENV->{database_execute_count}++;
my $dbh;
if (!($dbh = getnewdbh($database))) {
@@ -2686,7 +2686,7 @@
if (!$statement_handle) {
my $error_string = $dbh->errstr() || '<unknown error>';
notify($ERRORS{'WARNING'}, 0, "could not prepare SQL statement, $sql_statement, $error_string");
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
return;
}
@@ -2695,7 +2695,7 @@
if (!defined($result)) {
my $error_string = $dbh->errstr() || '<unknown error>';
$statement_handle->finish;
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
if (wantarray) {
return (0, $error_string);
@@ -2717,7 +2717,7 @@
my $sql_insertid = $statement_handle->{'mysql_insertid'};
my $sql_warning_count = $statement_handle->{'mysql_warning_count'};
$statement_handle->finish;
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
if ($sql_insertid) {
return $sql_insertid;
}
@@ -2727,7 +2727,7 @@
}
else {
$statement_handle->finish;
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
return $result;
}
@@ -2775,7 +2775,7 @@
if (!$statement_handle) {
my $error_string = $dbh->errstr() || '<unknown error>';
notify($ERRORS{'WARNING'}, 0, "failed to prepare SQL UPDATE statement, $update_statement, $error_string");
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
return;
}
@@ -2785,14 +2785,14 @@
if (!defined($result)) {
my $error_string = $dbh->errstr() || '<unknown error>';
$statement_handle->finish;
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
notify($ERRORS{'WARNING'}, 0, "failed to execute SQL UPDATE statement: $update_statement\nerror:\n$error_string");
return;
}
my $updated_row_count = $statement_handle->rows;
$statement_handle->finish;
- $dbh->disconnect if !defined $ENV{dbh};
+ $dbh->disconnect if !defined $ENV->{dbh};
$update_statement =~ s/[\n\s]+/ /g;
notify($ERRORS{'DEBUG'}, 0, "returning number of rows affected by UPDATE statement: $updated_row_count\n$update_statement");
@@ -2935,7 +2935,7 @@
# Populate natport table for reservation
# Make sure this wasn't called from populate_reservation_natport or else recursive loop will occur
- if (defined $ENV{reservation_id} && $ENV{reservation_id} eq $reservation_id) {
+ if (defined $ENV->{reservation_id} && $ENV->{reservation_id} eq $reservation_id) {
my $caller_trace = get_caller_trace(5);
if ($caller_trace !~ /populate_reservation_natport/) {
if ($request_state_name =~ /(new|reserved|modified|test)/) {
@@ -3094,8 +3094,8 @@
return;
}
- if (!$no_cache && defined($ENV{log_info}{$request_id})) {
- return $ENV{log_info}{$request_id};
+ if (!$no_cache && defined($ENV->{log_info}->{$request_id})) {
+ return $ENV->{log_info}->{$request_id};
}
# Get a hash ref containing the database column names
@@ -3169,7 +3169,7 @@
}
}
- $ENV{log_info}{$request_id} = $log_info;
+ $ENV->{log_info}->{$request_id} = $log_info;
#notify($ERRORS{'DEBUG'}, 0, "retrieved log info for request $request_id:\n" . format_data($log_info));
return $log_info;
}
@@ -3363,11 +3363,11 @@
}
# Check if cached image info exists
- if (!$no_cache && defined($ENV{image_info}{$image_identifier})) {
+ if (!$no_cache && defined($ENV->{image_info}->{$image_identifier})) {
# Check the time the info was last retrieved
- my $data_age_seconds = (time - $ENV{image_info}{$image_identifier}{RETRIEVAL_TIME});
+ my $data_age_seconds = (time - $ENV->{image_info}->{$image_identifier}->{RETRIEVAL_TIME});
if ($data_age_seconds < 600) {
- return $ENV{image_info}{$image_identifier};
+ return $ENV->{image_info}->{$image_identifier};
}
else {
notify($ERRORS{'DEBUG'}, 0, "retrieving current image info for '$image_identifier' from database, cached data is stale: $data_age_seconds seconds old");
@@ -3492,9 +3492,9 @@
$image_info->{imagedomain} = $domain_info;
#notify($ERRORS{'DEBUG'}, 0, "retrieved info for image '$image_identifier':\n" . format_data($image_info));
- $ENV{image_info}{$image_identifier} = $image_info;
- $ENV{image_info}{$image_identifier}{RETRIEVAL_TIME} = time;
- return $ENV{image_info}{$image_identifier};
+ $ENV->{image_info}->{$image_identifier} = $image_info;
+ $ENV->{image_info}->{$image_identifier}->{RETRIEVAL_TIME} = time;
+ return $ENV->{image_info}->{$image_identifier};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -3515,11 +3515,11 @@
}
# Check if cached imagerevision info exists
- if (!$no_cache && defined($ENV{imagerevision_info}{$imagerevision_identifier})) {
+ if (!$no_cache && defined($ENV->{imagerevision_info}->{$imagerevision_identifier})) {
# Check the time the info was last retrieved
- my $data_age_seconds = (time - $ENV{imagerevision_info}{$imagerevision_identifier}{RETRIEVAL_TIME});
+ my $data_age_seconds = (time - $ENV->{imagerevision_info}->{$imagerevision_identifier}->{RETRIEVAL_TIME});
if ($data_age_seconds < 600) {
- return $ENV{imagerevision_info}{$imagerevision_identifier};
+ return $ENV->{imagerevision_info}->{$imagerevision_identifier};
}
else {
notify($ERRORS{'DEBUG'}, 0, "retrieving current imagerevision info for '$imagerevision_identifier' from database, cached data is stale: $data_age_seconds seconds old");
@@ -3571,10 +3571,10 @@
$imagerevision_info->{user} = get_user_info($imagerevision_info->{userid});
# Add the info to %ENV so it doesn't need to be retrieved from the database again
- $ENV{imagerevision_info}{$imagerevision_identifier} = $imagerevision_info;
- $ENV{imagerevision_info}{$imagerevision_identifier}{RETRIEVAL_TIME} = time;
+ $ENV->{imagerevision_info}->{$imagerevision_identifier} = $imagerevision_info;
+ $ENV->{imagerevision_info}->{$imagerevision_identifier}->{RETRIEVAL_TIME} = time;
#notify($ERRORS{'DEBUG'}, 0, "retrieved info from database for imagerevision '$imagerevision_identifier':\n" . format_data($ENV{imagerevision_info}{$imagerevision_identifier}));
- return $ENV{imagerevision_info}{$imagerevision_identifier};
+ return $ENV->{imagerevision_info}->{$imagerevision_identifier};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -3597,7 +3597,7 @@
return;
}
- return $ENV{production_imagerevision_info}{$image_identifier} if (!$no_cache && $ENV{production_imagerevision_info}{$image_identifier});
+ return $ENV->{production_imagerevision_info}->{$image_identifier} if (!$no_cache && $ENV->{production_imagerevision_info}->{$image_identifier});
my $select_statement = <<EOF;
SELECT
@@ -3638,9 +3638,9 @@
my $imagerevision_info = get_imagerevision_info($imagerevision_id);
my $image_name = $imagerevision_info->{imagename};
- $ENV{production_imagerevision_info}{$image_identifier} = $imagerevision_info;
+ $ENV->{production_imagerevision_info}->{$image_identifier} = $imagerevision_info;
notify($ERRORS{'DEBUG'}, 0, "retrieved info from database for production revision for image identifier '$image_identifier', production image: '$image_name'");
- return $ENV{production_imagerevision_info}{$image_identifier};
+ return $ENV->{production_imagerevision_info}->{$image_identifier};
} ## end sub get_production_imagerevision_info
@@ -3665,7 +3665,7 @@
}
# Delete cached data
- delete $ENV{production_imagerevision_info};
+ delete $ENV->{production_imagerevision_info};
my $sql_statement = <<EOF;
UPDATE
@@ -3779,8 +3779,8 @@
return $default_imagemeta_info;
}
- if (!$no_cache && $ENV{imagemeta_info}{$imagemeta_id}) {
- return $ENV{imagemeta_info}{$imagemeta_id};
+ if (!$no_cache && $ENV->{imagemeta_info}->{$imagemeta_id}) {
+ return $ENV->{imagemeta_info}->{$imagemeta_id};
}
# If imagemetaid isnt' NULL, perform another query to get the meta info
@@ -3798,10 +3798,10 @@
# Check to make sure 1 row was returned
if (!@selected_rows || scalar @selected_rows > 1) {
- $ENV{imagemeta_info}{$imagemeta_id} = $default_imagemeta_info;
+ $ENV->{imagemeta_info}->{$imagemeta_id} = $default_imagemeta_info;
notify($ERRORS{'WARNING'}, 0, "failed to retrieve imagemeta ID=$imagemeta_id, returning default imagemeta values");
- return $ENV{imagemeta_info}{$imagemeta_id};
+ return $ENV->{imagemeta_info}->{$imagemeta_id};
}
# Get the single row returned from the select statement
@@ -3814,8 +3814,8 @@
}
notify($ERRORS{'DEBUG'}, 0, "retrieved imagemeta info:\n" . format_data($imagemeta_info));
- $ENV{imagemeta_info}{$imagemeta_id} = $imagemeta_info;
- return $ENV{imagemeta_info}{$imagemeta_id};
+ $ENV->{imagemeta_info}->{$imagemeta_id} = $imagemeta_info;
+ return $ENV->{imagemeta_info}->{$imagemeta_id};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -3830,11 +3830,11 @@
sub get_default_imagemeta_info {
- if ($ENV{imagemeta_info}{default}) {
+ if ($ENV->{imagemeta_info}->{default}) {
# Create a copy to ensure that the correct default data is returned
# Other processes may use the same cached copy
# If the same reference is returned for multiple processes, one process may alter the data
- my %default_imagemeta_info = %{$ENV{imagemeta_info}{default}};
+ my %default_imagemeta_info = %{$ENV->{imagemeta_info}->{default}};
return \%default_imagemeta_info;
}
@@ -3858,9 +3858,9 @@
}
}
- $ENV{imagemeta_info}{default} = $default_imagemeta_info;
+ $ENV->{imagemeta_info}->{default} = $default_imagemeta_info;
- my %default_imagemeta_info_copy = %{$ENV{imagemeta_info}{default}};
+ my %default_imagemeta_info_copy = %{$ENV->{imagemeta_info}->{default}};
#notify($ERRORS{'DEBUG'}, 0, "retrieved default imagemeta info:\n" . format_data(\%default_imagemeta_info_copy));
return \%default_imagemeta_info_copy;
}
@@ -3889,7 +3889,7 @@
return;
}
- return $ENV{vmhost_info}{$vmhost_identifier} if (!$no_cache && $ENV{vmhost_info}{$vmhost_identifier});
+ return $ENV->{vmhost_info}->{$vmhost_identifier} if (!$no_cache && $ENV->{vmhost_info}->{$vmhost_identifier});
my $management_node_id = get_management_node_id();
@@ -4067,14 +4067,14 @@
my $vmhost_id = $vmhost_info->{id};
notify($ERRORS{'DEBUG'}, 0, "retrieved VM host $vmhost_identifier info, VM host ID: $vmhost_id, computer: $vmhost_info->{computer}{hostname}, computer ID: $vmhost_info->{computer}{id}");
- $ENV{vmhost_info}{$vmhost_identifier} = $vmhost_info;
+ $ENV->{vmhost_info}->{$vmhost_identifier} = $vmhost_info;
if ($vmhost_identifier ne $vmhost_id) {
- $ENV{vmhost_info}{$vmhost_id} = $vmhost_info;
+ $ENV->{vmhost_info}->{$vmhost_id} = $vmhost_info;
}
- return $ENV{vmhost_info}{$vmhost_identifier};
+ return $ENV->{vmhost_info}->{$vmhost_identifier};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -4153,10 +4153,10 @@
$identity_paths = $management_node_info->{keys}
}
- # TESTING: use the new subroutine if $ENV{execute_new} is set and the command isn't one that's known to fail with the new subroutine
+ # TESTING: use the new subroutine if $ENV->{execute_new} is set and the command isn't one that's known to fail with the new subroutine
my $calling_subroutine = get_calling_subroutine();
if ($calling_subroutine && $calling_subroutine !~ /execute/) {
- if ($ENV{execute_new} && $command !~ /(vmkfstools|qemu-img|Convert-VHD|scp|reboot|shutdown)/) {
+ if ($ENV->{execute_new} && $command !~ /(vmkfstools|qemu-img|Convert-VHD|scp|reboot|shutdown)/) {
return VCL::Module::OS::execute_new($node, $command, $output_level, $timeout_seconds, $max_attempts, $port, $user, '', $identity_paths);
}
}
@@ -4656,24 +4656,24 @@
}
}
- if (!defined($ENV{management_node_info}) || !ref($ENV{management_node_info}) || ref($ENV{management_node_info}) ne 'HASH') {
+ if (!defined($ENV->{management_node_info}) || !ref($ENV->{management_node_info}) || ref($ENV->{management_node_info}) ne 'HASH') {
notify($ERRORS{'DEBUG'}, 0, "initializing management node info hash reference");
- $ENV{management_node_info} = {};
+ $ENV->{management_node_info} = {};
}
- if (defined($ENV{management_node_info}{$management_node_identifier})) {
- my $data_age_seconds = (time - $ENV{management_node_info}{$management_node_identifier}{RETRIEVAL_TIME});
+ if (defined($ENV->{management_node_info}->{$management_node_identifier})) {
+ my $data_age_seconds = (time - $ENV->{management_node_info}->{$management_node_identifier}->{RETRIEVAL_TIME});
if ($data_age_seconds < 60) {
#notify($ERRORS{'DEBUG'}, 0, "returning previously retrieved management node info for '$management_node_identifier'");
- return $ENV{management_node_info}{$management_node_identifier};
+ return $ENV->{management_node_info}->{$management_node_identifier};
}
else {
#notify($ERRORS{'DEBUG'}, 0, "retrieving current management node info for '$management_node_identifier' from database, cached data is stale: $data_age_seconds seconds old");
}
}
else {
- notify($ERRORS{'DEBUG'}, 0, "management node info for '$management_node_identifier' is not stored in \$ENV{management_node_info}");
+ notify($ERRORS{'DEBUG'}, 0, "management node info for '$management_node_identifier' is not stored in \$ENV->{management_node_info}");
}
my $select_statement = "
@@ -4786,23 +4786,23 @@
# Get the inuse timing checks for general and server based reservations
my $general_inuse_check = get_variable('general_inuse_check') || 300;
$management_node_info->{GENERAL_INUSE_CHECK} = round($general_inuse_check / 60);
- $ENV{management_node_info}{GENERAL_INUSE_CHECK} = $management_node_info->{GENERAL_INUSE_CHECK};
+ $ENV->{management_node_info}->{GENERAL_INUSE_CHECK} = $management_node_info->{GENERAL_INUSE_CHECK};
my $server_inuse_check = get_variable('server_inuse_check') || 300;
$management_node_info->{SERVER_INUSE_CHECK} = round($server_inuse_check / 60);
- $ENV{management_node_info}{SERVER_INUSE_CHECK} = $management_node_info->{SERVER_INUSE_CHECK};
+ $ENV->{management_node_info}->{SERVER_INUSE_CHECK} = $management_node_info->{SERVER_INUSE_CHECK};
my $cluster_inuse_check = get_variable('cluster_inuse_check') || 300;
$management_node_info->{CLUSTER_INUSE_CHECK} = round($cluster_inuse_check / 60);
- $ENV{management_node_info}{CLUSTER_INUSE_CHECK} = $management_node_info->{CLUSTER_INUSE_CHECK};
+ $ENV->{management_node_info}->{CLUSTER_INUSE_CHECK} = $management_node_info->{CLUSTER_INUSE_CHECK};
my $user_password_length = get_variable('user_password_length') || 6;
$management_node_info->{USER_PASSWORD_LENGTH} = $user_password_length;
- $ENV{management_node_info}{USER_PASSWORD_LENGTH} = $management_node_info->{USER_PASSWORD_LENGTH};
+ $ENV->{management_node_info}->{USER_PASSWORD_LENGTH} = $management_node_info->{USER_PASSWORD_LENGTH};
my $user_password_include_spchar = get_variable('user_password_spchar') || 0;
$management_node_info->{INCLUDE_SPECIAL_CHARS} = $user_password_include_spchar;
- $ENV{management_node_info}{INCLUDE_SPECIAL_CHARS} = $management_node_info->{INCLUDE_SPECIAL_CHARS};
+ $ENV->{management_node_info}->{INCLUDE_SPECIAL_CHARS} = $management_node_info->{INCLUDE_SPECIAL_CHARS};
# Get the OS name
my $os_name = lc($^O);
@@ -4818,16 +4818,16 @@
$management_node_info->{SYSADMIN_EMAIL} = $management_node_info->{sysadminEmailAddress};
$management_node_info->{SHARED_EMAIL_BOX} = $management_node_info->{sharedMailBox};
- # Store the info in $ENV{management_node_info}
+ # Store the info in $ENV->{management_node_info}
# Add keys for all of the unique identifiers that may be passed as an argument to this subroutine
- $ENV{management_node_info}{$management_node_identifier} = $management_node_info;
- $ENV{management_node_info}{$management_node_info->{hostname}} = $management_node_info;
- $ENV{management_node_info}{$management_node_info->{SHORTNAME}} = $management_node_info;
- $ENV{management_node_info}{$management_node_info->{id}} = $management_node_info;
- $ENV{management_node_info}{$management_node_info->{IPaddress}} = $management_node_info;
+ $ENV->{management_node_info}->{$management_node_identifier} = $management_node_info;
+ $ENV->{management_node_info}->{$management_node_info->{hostname}} = $management_node_info;
+ $ENV->{management_node_info}->{$management_node_info->{SHORTNAME}} = $management_node_info;
+ $ENV->{management_node_info}->{$management_node_info->{id}} = $management_node_info;
+ $ENV->{management_node_info}->{$management_node_info->{IPaddress}} = $management_node_info;
# Save the time when the data was retrieved
- $ENV{management_node_info}{$management_node_identifier}{RETRIEVAL_TIME} = time;
+ $ENV->{management_node_info}->{$management_node_identifier}->{RETRIEVAL_TIME} = time;
#notify($ERRORS{'DEBUG'}, 0, "retrieved management node info: '$management_node_identifier' ($management_node_info->{SHORTNAME})");
return $management_node_info;
@@ -5109,7 +5109,7 @@
$computer_string .= " ($computer_id)" if ($computer_identifier ne $computer_id);
# Delete cached data if previously set
- delete $ENV{computer_private_ip_address}{$computer_id};
+ delete $ENV->{computer_private_ip_address}->{$computer_id};
my $private_ip_address_text;
if ($private_ip_address =~ /null/i) {
@@ -5133,7 +5133,7 @@
# Call the database execute subroutine
if (database_execute($update_statement)) {
if ($private_ip_address !~ /null/i) {
- $ENV{computer_private_ip_address}{$computer_id} = $private_ip_address;
+ $ENV->{computer_private_ip_address}->{$computer_id} = $private_ip_address;
}
notify($ERRORS{'OK'}, 0, "updated private IP address of computer $computer_string in database: $private_ip_address");
return 1;
@@ -6639,11 +6639,11 @@
}
# Check if cached user info exists
- if (!$no_cache && defined($ENV{user_info}{$user_identifier})) {
+ if (!$no_cache && defined($ENV->{user_info}->{$user_identifier})) {
# Check the time the info was last retrieved
- my $data_age_seconds = (time - $ENV{user_info}{$user_identifier}{RETRIEVAL_TIME});
+ my $data_age_seconds = (time - $ENV->{user_info}->{$user_identifier}->{RETRIEVAL_TIME});
if ($data_age_seconds < 600) {
- return $ENV{user_info}{$user_identifier};
+ return $ENV->{user_info}->{$user_identifier};
}
else {
notify($ERRORS{'DEBUG'}, 0, "retrieving current user info for '$user_identifier' from database, cached data is stale: $data_age_seconds seconds old");
@@ -6791,9 +6791,9 @@
}
#notify($ERRORS{'DEBUG'}, 0, "retrieved info for user '$user_identifier', affiliation: '$affiliation_identifier':\n" . format_data($user_info));
- $ENV{user_info}{$user_identifier} = $user_info;
- $ENV{user_info}{$user_identifier}{RETRIEVAL_TIME} = time;
- return $ENV{user_info}{$user_identifier};
+ $ENV->{user_info}->{$user_identifier} = $user_info;
+ $ENV->{user_info}->{$user_identifier}->{RETRIEVAL_TIME} = time;
+ return $ENV->{user_info}->{$user_identifier};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -6911,8 +6911,8 @@
return;
}
- if (!$no_cache && defined($ENV{computer_info}{$computer_identifier})) {
- return $ENV{computer_info}{$computer_identifier};
+ if (!$no_cache && defined($ENV->{computer_info}->{$computer_identifier})) {
+ return $ENV->{computer_info}->{$computer_identifier};
}
#notify($ERRORS{'DEBUG'}, 0, "retrieving info for computer $computer_identifier");
@@ -7125,9 +7125,9 @@
}
notify($ERRORS{'DEBUG'}, 0, "retrieved info for computer: $computer_hostname ($computer_id)");
- $ENV{computer_info}{$computer_identifier} = $computer_info;
- $ENV{computer_info}{$computer_identifier}{RETRIEVAL_TIME} = time;
- return $ENV{computer_info}{$computer_identifier};
+ $ENV->{computer_info}->{$computer_identifier} = $computer_info;
+ $ENV->{computer_info}->{$computer_identifier}->{RETRIEVAL_TIME} = time;
+ return $ENV->{computer_info}->{$computer_identifier};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -7170,7 +7170,7 @@
return;
}
- return $ENV{nathost_info}{$computer_identifier} if (!$no_cache && $ENV{nathost_info}{$computer_identifier});
+ return $ENV->{nathost_info}->{$computer_identifier} if (!$no_cache && $ENV->{nathost_info}->{$computer_identifier});
# Get a hash ref containing the database column names
my $database_table_columns = get_database_table_columns();
@@ -7287,8 +7287,8 @@
}
#notify($ERRORS{'DEBUG'}, 0, "retrieved info for NAT host mapped to computer computer $computer_identifier:\n" . format_data($nathost_info));
- $ENV{nathost_info}{$computer_identifier} = $nathost_info;
- return $ENV{nathost_info}{$computer_identifier};
+ $ENV->{nathost_info}->{$computer_identifier} = $nathost_info;
+ return $ENV->{nathost_info}->{$computer_identifier};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -7338,7 +7338,7 @@
=cut
sub get_natport_ranges {
- return @{$ENV{natport_ranges}} if defined($ENV{natport_ranges});
+ return @{$ENV->{natport_ranges}} if defined($ENV->{natport_ranges});
# Retrieve and parse the natport_ranges variable
my $natport_ranges_variable = get_variable('natport_ranges') || '49152-65535';
@@ -7362,7 +7362,7 @@
}
notify($ERRORS{'DEBUG'}, 0, "parsed natport_ranges variable:\n" . format_data(@natport_ranges));
- $ENV{natport_ranges} = \@natport_ranges;
+ $ENV->{natport_ranges} = \@natport_ranges;
return @natport_ranges;
}
@@ -7906,8 +7906,8 @@
return;
}
- if (!$no_cache && defined($ENV{reservation_management_node_hostname}{$reservation_id})) {
- return $ENV{reservation_management_node_hostname}{$reservation_id};
+ if (!$no_cache && defined($ENV->{reservation_management_node_hostname}->{$reservation_id})) {
+ return $ENV->{reservation_management_node_hostname}->{$reservation_id};
}
my $select_statement = <<EOF;
@@ -7930,7 +7930,7 @@
my $row = $selected_rows[0];
my $hostname = $row->{hostname};
notify($ERRORS{'DEBUG'}, 0, "retrieved management node hostname for reservation $reservation_id: hostname");
- $ENV{reservation_management_node_hostname}{$reservation_id} = $hostname;
+ $ENV->{reservation_management_node_hostname}->{$reservation_id} = $hostname;
return $hostname;
}
@@ -7951,8 +7951,8 @@
return;
}
- if (!$no_cache && defined($ENV{reservation_request_id}{$reservation_id})) {
- return $ENV{reservation_request_id}{$reservation_id};
+ if (!$no_cache && defined($ENV->{reservation_request_id}->{$reservation_id})) {
+ return $ENV->{reservation_request_id}->{$reservation_id};
}
my $select_statement = "SELECT requestid FROM reservation WHERE id = '$reservation_id'";
@@ -7965,7 +7965,7 @@
my $row = $selected_rows[0];
my $request_id = $row->{requestid};
notify($ERRORS{'DEBUG'}, 0, "retrieved reservation $reservation_id request ID: $request_id");
- $ENV{reservation_request_id}{$reservation_id} = $request_id;
+ $ENV->{reservation_request_id}->{$reservation_id} = $request_id;
return $request_id;
}
@@ -8817,8 +8817,8 @@
my $management_node_id;
# Check the management_node_id environment variable
- if ($ENV{management_node_id}) {
- return $ENV{management_node_id};
+ if ($ENV->{management_node_id}) {
+ return $ENV->{management_node_id};
}
else {
notify($ERRORS{'DEBUG'}, 0, "management_node_id environment variable not set");
@@ -8828,7 +8828,7 @@
my $management_node_info = get_management_node_info();
if ($management_node_info && ($management_node_id = $management_node_info->{id})) {
notify($ERRORS{'DEBUG'}, 0, "get_managementnode_info(): $management_node_id");
- $ENV{management_node_id} = $management_node_id;
+ $ENV->{management_node_id} = $management_node_id;
return $management_node_id;
}
else {
@@ -8852,7 +8852,7 @@
sub get_database_names {
my $no_cache = shift;
- return @{$ENV{database_names}} if $ENV{database_names} && !$no_cache;
+ return @{$ENV->{database_names}} if $ENV->{database_names} && !$no_cache;
my $select_statement = "
SELECT DISTINCT
@@ -8874,9 +8874,9 @@
my @database_names;
map({push @database_names, $_->{SCHEMA_NAME}} @rows);
- $ENV{database_names} = \@database_names;
+ $ENV->{database_names} = \@database_names;
- return @{$ENV{database_names}};
+ return @{$ENV->{database_names}};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -8946,7 +8946,7 @@
sub get_database_table_columns {
my $no_cache = shift;
- return $ENV{database_table_columns} if $ENV{database_table_columns} && !$no_cache;
+ return $ENV->{database_table_columns} if $ENV->{database_table_columns} && !$no_cache;
my $database = 'information_schema';
@@ -8978,9 +8978,9 @@
my %database_table_columns;
map({push @{$database_table_columns{$_->{TABLE_NAME}}}, $_->{COLUMN_NAME}} @rows);
- $ENV{database_table_columns} = \%database_table_columns;
+ $ENV->{database_table_columns} = \%database_table_columns;
- return $ENV{database_table_columns};
+ return $ENV->{database_table_columns};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -9551,8 +9551,8 @@
$numeral_system = 'decimal';
}
- if (defined($ENV{ascii_value}{$character}{$numeral_system})) {
- return $ENV{ascii_value}{$character}{$numeral_system};
+ if (defined($ENV->{ascii_value}->{$character}->{$numeral_system})) {
+ return $ENV->{ascii_value}->{$character}->{$numeral_system};
}
my $decimal_value = unpack("C*", $character);
@@ -9563,7 +9563,7 @@
};
# Store the results in %ENV to avoid repetitive messages in vcld.log
- $ENV{ascii_value}{$character} = $values;
+ $ENV->{ascii_value}->{$character} = $values;
my $string = "ASCII $numeral_system value of '$character': $values->{$numeral_system}";
if ($numeral_system ne 'decimal') {
@@ -9694,7 +9694,7 @@
# Call send_request
my $response = $client->send_request(@arguments);
- $ENV{rpc_xml_response} = $response;
+ $ENV->{rpc_xml_response} = $response;
if (!ref($response)) {
notify($ERRORS{'WARNING'}, 0, "RPC::XML::Client::send_request failed\n" .
@@ -9706,8 +9706,8 @@
#"client: '$client'\n" . format_data($client)
);
- $ENV{rpc_xml_error} = $response;
- $ENV{rpc_xml_error} =~ s/^RPC::XML::Client::send_request:\s*//;
+ $ENV->{rpc_xml_error} = $response;
+ $ENV->{rpc_xml_error} =~ s/^RPC::XML::Client::send_request:\s*//;
return;
}
@@ -9721,7 +9721,7 @@
"fault code: " . $response->code . "\n" .
"fault string: " . $response->string
);
- $ENV{rpc_xml_error} = $response->string;
+ $ENV->{rpc_xml_error} = $response->string;
return;
}
@@ -11052,7 +11052,7 @@
print "$choices[$i-1]\n";
}
- print "\n[" . join("/", @{$ENV{setup_path}}) . "]\n" if defined($ENV{setup_path});
+ print "\n[" . join("/", @{$ENV->{setup_path}}) . "]\n" if defined($ENV->{setup_path});
print "Make a selection (1";
print "-$choice_count" if ($choice_count > 1);
print ", 'c' to cancel or when done): ";
@@ -11086,7 +11086,7 @@
sub setup_get_choice {
my ($choice_count) = @_;
- print "\n[" . join("/", @{$ENV{setup_path}}) . "]\n" if defined($ENV{setup_path});
+ print "\n[" . join("/", @{$ENV->{setup_path}}) . "]\n" if defined($ENV->{setup_path});
while (1) {
print "Make a selection (1";
print "-$choice_count" if ($choice_count > 1);
@@ -11165,8 +11165,8 @@
# Check if a Term::ReadLine object has already been created
my $term;
- if (defined($ENV{term_readline})) {
- $term = $ENV{term_readline};
+ if (defined($ENV->{term_readline})) {
+ $term = $ENV->{term_readline};
}
else {
$term = Term::ReadLine->new('ReadLine');
@@ -11181,7 +11181,7 @@
$attribs->{completion_function} = \&_term_readline_complete_file_path;
}
- $ENV{term_readline} = $term;
+ $ENV->{term_readline} = $term;
}
$message = '' unless $message;
@@ -11501,7 +11501,7 @@
# Make sure the parent vcld daemon process didn't call this subroutine for safety
# Prevents all reservations being processed from being killed
- if ($ENV{vcld}) {
+ if ($ENV->{vcld}) {
notify($ERRORS{'CRITICAL'}, 0, "kill_child_processes subroutine called from the parent vcld process, not killing any processes for safety");
return;
}
@@ -11606,13 +11606,13 @@
}
# Check if cached info exists
- if (!$no_cache && defined($ENV{connect_method_info}{$reservation_id})) {
- my $connect_method_id = (keys(%{$ENV{connect_method_info}{$reservation_id}}))[0];
+ if (!$no_cache && defined($ENV->{connect_method_info}->{$reservation_id})) {
+ my $connect_method_id = (keys(%{$ENV->{connect_method_info}->{$reservation_id}}))[0];
if ($connect_method_id) {
# Check the time the info was last retrieved
- my $data_age_seconds = (time - $ENV{connect_method_info}{$reservation_id}{$connect_method_id}{RETRIEVAL_TIME});
+ my $data_age_seconds = (time - $ENV->{connect_method_info}->{$reservation_id}->{$connect_method_id}->{RETRIEVAL_TIME});
if ($data_age_seconds < 600) {
- return $ENV{connect_method_info}{$reservation_id};
+ return $ENV->{connect_method_info}->{$reservation_id};
}
else {
notify($ERRORS{'DEBUG'}, 0, "retrieving current connect method info for reservation $reservation_id from database, cached data is stale: $data_age_seconds seconds old");
@@ -11717,8 +11717,8 @@
}
notify($ERRORS{'DEBUG'}, 0, "retrieved connect method info for reservation $reservation_id:\n" . format_data($connect_method_info));
- $ENV{connect_method_info}{$reservation_id} = $connect_method_info;
- return $ENV{connect_method_info}{$reservation_id};
+ $ENV->{connect_method_info}->{$reservation_id} = $connect_method_info;
+ return $ENV->{connect_method_info}->{$reservation_id};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -11950,7 +11950,7 @@
# Attempt to retrieve the contents of currentimage.txt
my $cat_command = "cat ~/currentimage.txt";
- my ($cat_exit_status, $cat_output) = run_ssh_command($computer_node_name, $ENV{management_node_info}{keys}, $cat_command);
+ my ($cat_exit_status, $cat_output) = run_ssh_command($computer_node_name, $ENV->{management_node_info}->{keys}, $cat_command);
if (!defined($cat_output)) {
notify($ERRORS{'WARNING'}, 0, "failed to execute command to failed to retrieve currentimage.txt from $computer_node_name");
return;
@@ -12038,27 +12038,27 @@
my ($seconds, $microseconds) = gettimeofday;
- if (!$ENV{'start'}) {
- $ENV{'start'} = [$seconds, $microseconds];
+ if (!$ENV->{'start'}) {
+ $ENV->{'start'} = [$seconds, $microseconds];
}
- if (defined($ENV{'stopwatch_count'})) {
- $ENV{'stopwatch_count'}++;
+ if (defined($ENV->{'stopwatch_count'})) {
+ $ENV->{'stopwatch_count'}++;
}
else {
- $ENV{'stopwatch_count'} = 'a';
+ $ENV->{'stopwatch_count'} = 'a';
}
- $ENV{'previous'} = $ENV{'current'} || $ENV{'start'};
+ $ENV->{'previous'} = $ENV->{'current'} || $ENV->{'start'};
- $ENV{'current'} = [$seconds, $microseconds];
+ $ENV->{'current'} = [$seconds, $microseconds];
- my $message = "[stopwatch] $ENV{'stopwatch_count'}: ";
+ my $message = "[stopwatch] $ENV->{'stopwatch_count'}: ";
$message .= "$title " if defined($title);
$title = '<none>' if !defined($title);
- my $previous_delta = sprintf("%.2f", tv_interval($ENV{'previous'}, $ENV{'current'}));
- my $start_delta = sprintf("%.2f", tv_interval($ENV{'start'}, $ENV{'current'}));
+ my $previous_delta = sprintf("%.2f", tv_interval($ENV->{'previous'}, $ENV->{'current'}));
+ my $start_delta = sprintf("%.2f", tv_interval($ENV->{'start'}, $ENV->{'current'}));
$start_delta = 0 if $start_delta =~ /e/;
$previous_delta = 0 if $previous_delta =~ /e/;
@@ -12068,19 +12068,19 @@
print "\n$message\n\n";
my $info = {
- current => $ENV{'current'},
- previous => $ENV{'previous'},
+ current => $ENV->{'current'},
+ previous => $ENV->{'previous'},
message => $message,
start_delta => $start_delta,
previous_delta => $previous_delta,
- title => "$ENV{'stopwatch_count'}: $title",
+ title => "$ENV->{'stopwatch_count'}: $title",
};
- if (!$ENV{stopwatch}) {
- $ENV{stopwatch} = [];
+ if (!$ENV->{stopwatch}) {
+ $ENV->{stopwatch} = [];
}
- push @{$ENV{stopwatch}}, $info;
+ push @{$ENV->{stopwatch}}, $info;
}
#//////////////////////////////////////////////////////////////////////////////
@@ -12170,9 +12170,9 @@
sub get_management_node_vmhost_ids {
my $management_node_identifier = shift || $FQDN;
- if ($ENV{management_node_vmhost_ids}{$management_node_identifier}) {
+ if ($ENV->{management_node_vmhost_ids}->{$management_node_identifier}) {
notify($ERRORS{'DEBUG'}, 0, "returning previously retrieved vmhost IDs assigned to management node: $management_node_identifier");
- return @{$ENV{management_node_vmhost_ids}{$management_node_identifier}};
+ return @{$ENV->{management_node_vmhost_ids}->{$management_node_identifier}};
}
notify($ERRORS{'DEBUG'}, 0, "retrieving vmhost IDs assigned to management node: $management_node_identifier");
@@ -12237,8 +12237,8 @@
my @vmhost_ids = map { $_->{id} } @selected_rows;
notify($ERRORS{'DEBUG'}, 0, "vmhost IDs assigned to $management_node_identifier (" . scalar(@vmhost_ids) . "): " . join(', ', @vmhost_ids));
- $ENV{management_node_vmhost_ids}{$management_node_identifier} = \@vmhost_ids;
- return @{$ENV{management_node_vmhost_ids}{$management_node_identifier}};
+ $ENV->{management_node_vmhost_ids}->{$management_node_identifier} = \@vmhost_ids;
+ return @{$ENV->{management_node_vmhost_ids}->{$management_node_identifier}};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -12254,8 +12254,8 @@
sub get_management_node_vmhost_info {
my $management_node_identifier = shift || $FQDN;
- return $ENV{management_node_vmhost_info}{$management_node_identifier} if $ENV{management_node_vmhost_info}{$management_node_identifier};
-
+ return $ENV->{management_node_vmhost_info}->{$management_node_identifier} if $ENV->{management_node_vmhost_info}->{$management_node_identifier};
+
my @management_node_vmhost_ids = get_management_node_vmhost_ids($management_node_identifier);
my $vmhost_info = {};
@@ -12265,8 +12265,8 @@
$vmhost_info->{$vmhost_id}{vmprofile_profilename} = $vmhost_info->{$vmhost_id}{vmprofile}{profilename};
}
- $ENV{management_node_vmhost_info}{$management_node_identifier} = $vmhost_info;
- return $ENV{management_node_vmhost_info}{$management_node_identifier};
+ $ENV->{management_node_vmhost_info}->{$management_node_identifier} = $vmhost_info;
+ return $ENV->{management_node_vmhost_info}->{$management_node_identifier};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -12287,8 +12287,8 @@
return;
}
- if (!$no_cache && defined($ENV{vmhost_assigned_vm_info}{$vmhost_id})) {
- return $ENV{vmhost_assigned_vm_info}{$vmhost_id};
+ if (!$no_cache && defined($ENV->{vmhost_assigned_vm_info}->{$vmhost_id})) {
+ return $ENV->{vmhost_assigned_vm_info}->{$vmhost_id};
}
my $select_statement = <<EOF;
@@ -12309,7 +12309,7 @@
$assigned_computer_info->{$computer_id} = $computer_info if $computer_info;
}
- $ENV{vmhost_assigned_vm_info}{$vmhost_id} = $assigned_computer_info;
+ $ENV->{vmhost_assigned_vm_info}->{$vmhost_id} = $assigned_computer_info;
notify($ERRORS{'DEBUG'}, 0, "retrieved computer info for VMs assigned to VM host $vmhost_id: " . join(', ', sort keys %$assigned_computer_info));
return $assigned_computer_info;
}
@@ -12386,8 +12386,8 @@
return;
}
- if (!$no_cache && defined($ENV{vmhost_assigned_vm_provisioning_info}{$vmhost_id})) {
- return $ENV{vmhost_assigned_vm_provisioning_info}{$vmhost_id};
+ if (!$no_cache && defined($ENV->{vmhost_assigned_vm_provisioning_info}->{$vmhost_id})) {
+ return $ENV->{vmhost_assigned_vm_provisioning_info}->{$vmhost_id};
}
my $vmhost_assigned_vm_info = get_vmhost_assigned_vm_info($vmhost_id, $no_cache) || return;
@@ -12402,7 +12402,7 @@
$vmhost_assigned_vm_provisioning_info->{$provisioning_id}{ASSIGNED_VM_COUNT}++;
}
- $ENV{vmhost_assigned_vm_provisioning_info}{$vmhost_id} = $vmhost_assigned_vm_provisioning_info;
+ $ENV->{vmhost_assigned_vm_provisioning_info}->{$vmhost_id} = $vmhost_assigned_vm_provisioning_info;
notify($ERRORS{'DEBUG'}, 0, "retrieved provisioning info for VMs assigned to VM host $vmhost_id:\n" . format_data($vmhost_assigned_vm_provisioning_info));
return $vmhost_assigned_vm_provisioning_info;
}
@@ -12470,7 +12470,7 @@
=cut
sub get_imagerevision_cleanup_info {
- return $ENV{imagerevision_cleanup_info} if $ENV{imagerevision_cleanup_info};
+ return $ENV->{imagerevision_cleanup_info} if $ENV->{imagerevision_cleanup_info};
my $sql = <<EOF;
SELECT
@@ -12518,8 +12518,8 @@
}
notify($ERRORS{'DEBUG'}, 0, "retrieved cleanup info for imagerevision entries in the database");
- $ENV{imagerevision_cleanup_info} = $imagerevision_cleanup_info;
- return $ENV{imagerevision_cleanup_info};
+ $ENV->{imagerevision_cleanup_info} = $imagerevision_cleanup_info;
+ return $ENV->{imagerevision_cleanup_info};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -12735,7 +12735,7 @@
=cut
sub get_imagerevision_names {
- return @{$ENV{imagerevision_names}} if $ENV{imagerevision_names};
+ return @{$ENV->{imagerevision_names}} if $ENV->{imagerevision_names};
my $sql = "SELECT imagerevision.imagename FROM imagerevision WHERE 1";
my @rows = database_select($sql);
@@ -12743,8 +12743,8 @@
my $imagerevision_count = scalar(@imagerevision_names);
notify($ERRORS{'DEBUG'}, 0, "retrieved $imagerevision_count imagerevision names from database");
- $ENV{imagerevision_names} = \@imagerevision_names;
- return @{$ENV{imagerevision_names}};
+ $ENV->{imagerevision_names} = \@imagerevision_names;
+ return @{$ENV->{imagerevision_names}};
}
#//////////////////////////////////////////////////////////////////////////////
@@ -13972,9 +13972,9 @@
my $computer_string = $computer_identifier;
$computer_string .= " ($computer_id)" if ($computer_identifier ne $computer_id);
- if (!$no_cache && defined($ENV{computer_private_ip_address}{$computer_id})) {
- notify($ERRORS{'DEBUG'}, 0, "returning cached private IP address for computer $computer_string: $ENV{computer_private_ip_address}{$computer_id}");
- return $ENV{computer_private_ip_address}{$computer_id};
+ if (!$no_cache && defined($ENV->{computer_private_ip_address}->{$computer_id})) {
+ notify($ERRORS{'DEBUG'}, 0, "returning cached private IP address for computer $computer_string: $ENV->{computer_private_ip_address}->{$computer_id}");
+ return $ENV->{computer_private_ip_address}->{$computer_id};
}
my $select_statement = <<EOF;
@@ -13998,7 +13998,7 @@
my $private_ip_address = $row->{privateIPaddress};
my $hostname = $row->{hostname};
if ($private_ip_address) {
- $ENV{computer_private_ip_address}{$computer_id} = $private_ip_address;
+ $ENV->{computer_private_ip_address}->{$computer_id} = $private_ip_address;
notify($ERRORS{'DEBUG'}, 0, "retrieved private IP address for computer $computer_string from database: $private_ip_address");
return $private_ip_address;
}
@@ -14257,7 +14257,7 @@
=cut
sub get_provisioning_table_info {
- return $ENV{provisioning_table_info} if (defined($ENV{provisioning_table_info}));
+ return $ENV->{provisioning_table_info} if (defined($ENV->{provisioning_table_info}));
# Get a hash ref containing the database column names
my $database_table_columns = get_database_table_columns();
@@ -14315,7 +14315,7 @@
}
}
- $ENV{provisioning_table_info} = $provisioning_table_info;
+ $ENV->{provisioning_table_info} = $provisioning_table_info;
notify($ERRORS{'DEBUG'}, 0, "retrieved provisioning info: " . format_data($provisioning_table_info));
return $provisioning_table_info;
}
@@ -14385,32 +14385,32 @@
# Remove anything preceeding it
$argument =~ s/.*@([^@]+)$/$1/g;
- if (!$no_cache && defined($ENV{remote_connection_target}{$argument})) {
- return $ENV{remote_connection_target}{$argument};
+ if (!$no_cache && defined($ENV->{remote_connection_target}->{$argument})) {
+ return $ENV->{remote_connection_target}->{$argument};
}
# If an IP address was passed, use it
if (is_valid_ip_address($argument, 0)) {
- $ENV{remote_connection_target}{$argument} = $argument;
- notify($ERRORS{'DEBUG'}, 0, "argument is a valid IP address, it will be used as the remote connection target: $ENV{remote_connection_target}{$argument}");
- return $ENV{remote_connection_target}{$argument};
+ $ENV->{remote_connection_target}->{$argument} = $argument;
+ notify($ERRORS{'DEBUG'}, 0, "argument is a valid IP address, it will be used as the remote connection target: $ENV->{remote_connection_target}->{$argument}");
+ return $ENV->{remote_connection_target}->{$argument};
}
# Attempt to retrieve the private IP address from the database
my $database_private_ip_address = get_computer_current_private_ip_address($argument);
if ($database_private_ip_address) {
- $ENV{remote_connection_target}{$argument} = $database_private_ip_address;
- notify($ERRORS{'DEBUG'}, 0, "private IP address is set in database for $argument, it will be used as the remote connection target: $ENV{remote_connection_target}{$argument}");
- return $ENV{remote_connection_target}{$argument};
+ $ENV->{remote_connection_target}->{$argument} = $database_private_ip_address;
+ notify($ERRORS{'DEBUG'}, 0, "private IP address is set in database for $argument, it will be used as the remote connection target: $ENV->{remote_connection_target}->{$argument}");
+ return $ENV->{remote_connection_target}->{$argument};
}
# Private IP address could not be retrieved from the database or is set to NULL
# Try to resolve the argument to an IP address
# First make sure it is a valid hostname
if (!is_valid_dns_host_name($argument)) {
- $ENV{remote_connection_target}{$argument} = $argument;
+ $ENV->{remote_connection_target}->{$argument} = $argument;
notify($ERRORS{'WARNING'}, 0, "failed to reliably determine the remote connection target to use for '$argument', it is not a valid IP address or DNS hostname");
- return $ENV{remote_connection_target}{$argument};
+ return $ENV->{remote_connection_target}->{$argument};
}
# Check if the hostname includes a DNS suffix
@@ -14432,14 +14432,14 @@
update_computer_private_ip_address($argument, $resolved_ip_address);
}
- $ENV{remote_connection_target}{$argument} = $resolved_ip_address;
+ $ENV->{remote_connection_target}->{$argument} = $resolved_ip_address;
notify($ERRORS{'DEBUG'}, 0, "$argument resolves to IP address $resolved_ip_address, it will be used as the remote connection target");
- return $ENV{remote_connection_target}{$argument};
+ return $ENV->{remote_connection_target}->{$argument};
}
else {
notify($ERRORS{'WARNING'}, 0, "failed to reliably determine the remote connection target to use for '$argument', it is not a valid IP address, a private IP address is not set in the database, and '$argument' does not resolve to an IP address on this management node");
- $ENV{remote_connection_target}{$argument} = $argument;
- return $ENV{remote_connection_target}{$argument};
+ $ENV->{remote_connection_target}->{$argument} = $argument;
+ return $ENV->{remote_connection_target}->{$argument};
}
}
@@ -15193,9 +15193,9 @@
return;
}
- if (!$no_cache && defined($ENV{management_node_ad_domain_credentials}{$domain_id})) {
+ if (!$no_cache && defined($ENV->{management_node_ad_domain_credentials}->{$domain_id})) {
notify($ERRORS{'DEBUG'}, 0, "returning cached Active Directory credentials for domain: $domain_id");
- return @{$ENV{management_node_ad_domain_credentials}{$domain_id}};
+ return @{$ENV->{management_node_ad_domain_credentials}->{$domain_id}};
}
# Construct the select statement
@@ -15233,8 +15233,8 @@
"secret ID : '$secret_id'\n" .
"encrypted password : '$encrypted_password'"
);
- $ENV{management_node_ad_domain_credentials}{$domain_id} = [$domain_dns_name, $username, $secret_id, $encrypted_password];
- return @{$ENV{management_node_ad_domain_credentials}{$domain_id}};
+ $ENV->{management_node_ad_domain_credentials}->{$domain_id} = [$domain_dns_name, $username, $secret_id, $encrypted_password];
+ return @{$ENV->{management_node_ad_domain_credentials}->{$domain_id}};
}
#//////////////////////////////////////////////////////////////////////////////
diff --git a/vcl-install.sh b/vcl-install.sh
index db59978..1f14fa6 100755
--- a/vcl-install.sh
+++ b/vcl-install.sh
@@ -81,7 +81,7 @@
PEMKEY=`random_string 20`
ARCHIVE=apache-VCL-$VCL_VERSION.tar.bz2
ARCHIVEURLPATH="http://vcl.apache.org/downloads/download.cgi?action=download&filename=%2Fvcl%2F$VCL_VERSION%2F"
-SIGPATH="https://www.apache.org/dist/vcl/$VCL_VERSION/"
+SIGPATH="https://downloads.apache.org/vcl/$VCL_VERSION/"
TZDEFAULT="America/New_York"
DODB=0
@@ -414,10 +414,10 @@
print_break
echo "Installing Linux packages..."
if [[ $DOMN -eq 1 ]]; then
- yum -q -y install openssh-clients wget perl
+ yum -q -y install openssh-clients wget perl bzip2
if [ $? -ne 0 ]; then "Error: Failed to install required linux packages (openssh-client, wget, and perl)"; exit 1; fi;
else
- yum -q -y install openssh-clients wget
+ yum -q -y install openssh-clients wget bzip2
if [ $? -ne 0 ]; then "Error: Failed to install required linux packages (openssh-client and wget)"; exit 1; fi;
fi
@@ -433,7 +433,7 @@
salt=$(random_string 8)
#echo "Password salt: $salt"
- passhash=$(echo -n $password$salt | sha1sum | awk '{print $1}')
+ passhash=$(echo -n $password$salt | sha512sum | awk '{print $1}')
#echo "Password hash: $passhash"
mysql -e "UPDATE localauth SET passhash = '$passhash', salt = '$salt', lastupdated = NOW() WHERE localauth.userid = (SELECT id FROM user WHERE unityid = '$username');" vcl
if [ $? -ne 0 ]; then
@@ -521,6 +521,8 @@
sleep 1
yum -q -y install perl-CPAN
if [ $? -ne 0 ]; then echo "Error: Failed to install perl-CPAN"; exit 1; fi;
+ yum -q -y install perl-App-cpanminus
+ if [ $? -ne 0 ]; then echo "Error: Failed to install perl-App-cpanminus"; exit 1; fi;
perl apache-VCL-$VCL_VERSION/managementnode/bin/install_perl_libs.pl
rc=$?
if [ $rc -eq 2 ]; then