You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2014/12/09 22:33:45 UTC
svn commit: r1644193 - in /vcl/trunk/managementnode/lib/VCL: ./ Module/
Module/OS/ Module/OS/Linux/ Module/Predictive/ Module/Provisioning/
Module/Provisioning/VMware/
Author: arkurth
Date: Tue Dec 9 21:33:44 2014
New Revision: 1644193
URL: http://svn.apache.org/r1644193
Log:
VCL-702
Fixing sloppy inconsistent code:
Removed blank spaces from lines ending with {
Added space after "if" and "while" statements before opening parenthesis
Added space before closing curly bracket if they occur at the end of a line
Modified:
vcl/trunk/managementnode/lib/VCL/DataStructure.pm
vcl/trunk/managementnode/lib/VCL/Module/OS.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm
vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm
vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
vcl/trunk/managementnode/lib/VCL/Module/State.pm
vcl/trunk/managementnode/lib/VCL/blockrequest.pm
vcl/trunk/managementnode/lib/VCL/healthcheck.pm
vcl/trunk/managementnode/lib/VCL/image.pm
vcl/trunk/managementnode/lib/VCL/inuse.pm
vcl/trunk/managementnode/lib/VCL/reclaim.pm
vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/DataStructure.pm Tue Dec 9 21:33:44 2014
@@ -1299,7 +1299,7 @@ sub get_next_image_dataStructure {
#collect predictive reload information from database.
my $computer_predictive_module_id = $self->get_computer_predictive_module_id();
- if (!$computer_predictive_module_id){
+ if (!$computer_predictive_module_id) {
notify($ERRORS{'CRITICAL'}, 0, "unable to obtain management node info for this node, returning current reservation image information");
return @current_image;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS.pm Tue Dec 9 21:33:44 2014
@@ -307,7 +307,7 @@ sub get_currentimage_txt_contents {
my @current_image_txt_contents = @{$cat_output};
my $current_image_name;
- if(defined $current_image_txt_contents[0]) {
+ if (defined $current_image_txt_contents[0]) {
$output{"current_image_name"} = $current_image_txt_contents[0];
}
@@ -315,7 +315,7 @@ sub get_currentimage_txt_contents {
#remove any line break characters
$l =~ s/[\r\n]*//g;
my ($a, $b) = split(/=/, $l);
- if(defined $b) {
+ if (defined $b) {
$output{$a} = $b;
}
}
@@ -347,7 +347,7 @@ sub get_current_image_info {
my $input = shift;
- if(!defined $input) {
+ if (!defined $input) {
$input = "imagerevision_id";
}
@@ -367,7 +367,7 @@ sub get_current_image_info {
if (defined $current_image_txt_contents{imagerevision_id}) {
notify($ERRORS{'DEBUG'}, 0, "user selected content of image currently loaded on $computer_node_name: $current_image_txt_contents{current_image_name}");
- if (my $imagerevision_info = get_imagerevision_info($current_image_txt_contents{imagerevision_id})){
+ if (my $imagerevision_info = get_imagerevision_info($current_image_txt_contents{imagerevision_id})) {
$self->data->set_computer_currentimage_data($imagerevision_info->{image});
$self->data->set_computer_currentimagerevision_data($imagerevision_info);
@@ -376,7 +376,7 @@ sub get_current_image_info {
}
}
- if (defined($current_image_txt_contents{$input})){
+ if (defined($current_image_txt_contents{$input})) {
return $current_image_txt_contents{$input};
}
else {
@@ -909,10 +909,10 @@ sub server_request_set_fixedIP {
my $server_request_id = $self->data->get_server_request_id();
my $server_request_fixedIP = $self->data->get_server_request_fixedIP();
- if($server_request_id) {
- if($server_request_fixedIP) {
+ if ($server_request_id) {
+ if ($server_request_fixedIP) {
#Update the info related to fixedIP
- if(!$self->update_fixedIP_info()) {
+ if (!$self->update_fixedIP_info()) {
notify($ERRORS{'WARNING'}, 0, "Unable to update information related fixedIP for server_request $server_request_id");
}
@@ -924,7 +924,7 @@ sub server_request_set_fixedIP {
}
#if set for static IPs, save the old address to restore
- if($public_ip_configuration =~ /static/i) {
+ if ($public_ip_configuration =~ /static/i) {
notify($ERRORS{'DEBUG'}, 0, "saving original IP for restore on post reseration");
my $original_IPvalue = "originalIPaddr_" . $server_request_id;
set_variable($original_IPvalue, $computer_public_ip_address);
@@ -945,7 +945,7 @@ sub server_request_set_fixedIP {
#Update Hostname to match Public assigned name
if ($self->can("update_public_hostname")) {
- if($self->update_public_hostname()){
+ if ($self->update_public_hostname()) {
notify($ERRORS{'OK'}, 0, "Updated hostname based on fixedIP $server_request_fixedIP");
}
}
@@ -995,14 +995,14 @@ sub confirm_fixedIP_is_available {
my $server_request_fixedIP = $self->data->get_server_request_fixedIP();
#check VCL computer table
- if(is_ip_assigned_query($server_request_fixedIP)) {
+ if (is_ip_assigned_query($server_request_fixedIP)) {
notify($ERRORS{'WARNING'}, 0, "$server_request_fixedIP is already assigned");
insertloadlog($reservation_id, $computer_id, "failed","$server_request_fixedIP is already assigned");
return 0;
}
#Is IP pingable
- if(_pingnode($server_request_fixedIP)) {
+ if (_pingnode($server_request_fixedIP)) {
notify($ERRORS{'WARNING'}, 0, "$server_request_fixedIP is answering ping test");
insertloadlog($reservation_id, $computer_id, "failed","$server_request_fixedIP is answering ping test, but is not assigned in VCL database");
return 0;
@@ -2561,11 +2561,11 @@ sub manage_server_access {
}
my $standalone = $user_hash{$userid}{user_info}{STANDALONE};
- if(!$self->user_exists($user_hash{$userid}{username})){
+ if (!$self->user_exists($user_hash{$userid}{username})) {
delete($res_accounts{$userid});
}
- if(!exists($res_accounts{$userid}) || $request_laststate_name eq "reinstall" ){
+ if (!exists($res_accounts{$userid}) || $request_laststate_name eq "reinstall" ) {
if($request_laststate_name ne "reinstall" ){
$user_hash{$userid}{"passwd"} = 0;
@@ -2579,7 +2579,7 @@ sub manage_server_access {
}
}
# if reinstall and standalone check for existing password
- if($request_laststate_name eq "reinstall") {
+ if ($request_laststate_name eq "reinstall") {
#notify($ERRORS{'OK'}, 0, "Reinstall mode for $user_hash{$userid}{unityid}" . format_data(%res_accounts));
if ( $res_accounts{$userid}{password} ) {
$user_hash{$userid}{passwd} = $res_accounts{$userid}{password};
@@ -2599,7 +2599,7 @@ sub manage_server_access {
}
# Create user on the OS
- if($self->create_user($user_hash{$userid}{unityid},$user_hash{$userid}{passwd},$user_hash{$userid}{uid},$user_hash{$userid}{ROOTACCESS},$standalone,$user_hash{$userid}{user_info}{user_sshPublicKeys})) {
+ if ($self->create_user($user_hash{$userid}{unityid},$user_hash{$userid}{passwd},$user_hash{$userid}{uid},$user_hash{$userid}{ROOTACCESS},$standalone,$user_hash{$userid}{user_info}{user_sshPublicKeys})) {
notify($ERRORS{'OK'}, 0, "Successfully created user $user_hash{$userid}{unityid} on $computer_node_name");
}
else {
@@ -2619,14 +2619,14 @@ sub manage_server_access {
#Skip group checks as the owner may not be a member
next;
}
- if(!exists($user_hash{$res_userid})) {
+ if (!exists($user_hash{$res_userid})) {
notify($ERRORS{'OK'}, 0, "username= $res_accounts{$res_userid}{username} is not listed in reservationsaccounts, attempting to delete");
#Delete from reservationaccounts
if (update_reservation_accounts($reservation_id,$res_accounts{$res_userid}{userid},0,"delete")) {
notify($ERRORS{'OK'}, 0, "Deleted $reservation_id,$res_accounts{$res_userid}{userid} from reservationsaccounts table");
}
#Delete from OS
- if($self->delete_user($res_accounts{$res_userid}{username},0,0)) {
+ if ($self->delete_user($res_accounts{$res_userid}{username},0,0)) {
notify($ERRORS{'OK'}, 0, "Successfully removed user= $res_accounts{$res_userid}{username}");
}
next;
@@ -2688,7 +2688,7 @@ sub process_connect_methods {
notify($ERRORS{'OK'}, 0, "reservation remote IP address is not defined, connect methods will be available from any IP address");
$remote_ip = '0.0.0.0/0';
}
- elsif ($remote_ip =~ /any/i){
+ elsif ($remote_ip =~ /any/i) {
notify($ERRORS{'OK'}, 0, "reservation remote IP address is set to ANY, connect methods will be available from any IP address");
$remote_ip = '0.0.0.0/0';
}
@@ -2760,7 +2760,7 @@ sub process_connect_methods {
if (!defined($startup_output)) {
notify($ERRORS{'WARNING'}, 0, "failed to run command to execute startup script '$startup_script' for '$name' connect method on $computer_node_name, command: '$startup_script'");
}
- elsif ($startup_exit_status == 0){
+ elsif ($startup_exit_status == 0) {
notify($ERRORS{'OK'}, 0, "executed startup script '$startup_script' for '$name' connect method on $computer_node_name, command: '$startup_script', exit status: $startup_exit_status, output:\n" . join("\n", @$startup_output));
}
else {
@@ -3318,7 +3318,7 @@ sub update_fixedIP_info {
}
my $server_request_id = $self->data->get_server_request_id();
- if(!$server_request_id) {
+ if (!$server_request_id) {
notify($ERRORS{'WARNING'}, 0, "Server request id not set.");
return;
}
@@ -3326,7 +3326,7 @@ sub update_fixedIP_info {
my $variable_name = "fixedIPsr" . $server_request_id;
my $server_variable_data;
- if(is_variable_set($variable_name)){
+ if (is_variable_set($variable_name)) {
#fetch variable
$server_variable_data = get_variable($variable_name);
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Tue Dec 9 21:33:44 2014
@@ -540,7 +540,7 @@ sub post_reserve {
#write to local temp file
my $tmpfile = "/tmp/$reservation_id" ."_post_reserve_userdata";
- if(open(TMP, ">$tmpfile")){
+ if (open(TMP, ">$tmpfile")) {
print TMP $variable_data;
close(TMP);
@@ -552,7 +552,7 @@ sub post_reserve {
notify($ERRORS{'WARNING'}, 0, "failed to open $tmpfile for writing userdata");
}
#Clean variable from variable table
- if(delete_variable($variable_name)){
+ if (delete_variable($variable_name)) {
notify($ERRORS{'DEBUG'}, 0, "Deleted variable_name $variable_name from variable table");
}
}
@@ -690,8 +690,8 @@ sub update_public_hostname {
# Set the node's hostname to public hostname
- if($self->can("update_hostname_file")) {
- if(!$self->update_hostname_file($public_hostname)) {
+ if ($self->can("update_hostname_file")) {
+ if (!$self->update_hostname_file($public_hostname)) {
notify($ERRORS{'WARNING'}, 0, "failed to update hostname file");
}
}
@@ -2651,7 +2651,7 @@ sub create_user {
my $home_directory_path = "/home/$user_login_id";
my $home_directory_root = "/home";
my $home_directory_on_local_disk = $self->is_file_on_local_disk($home_directory_root);
- if($home_directory_on_local_disk ) {
+ if ($home_directory_on_local_disk ) {
my $useradd_command = "/usr/sbin/useradd -s /bin/bash -m -d /home/$user_login_id -g vcl";
$useradd_command .= " -u $uid" if ($uid);
@@ -2708,7 +2708,7 @@ sub create_user {
# Check image profile for allowed root access
# If the imagemeta root access is disable don't allow manage_server_access to override
- if(defined($imagemeta_root_access) && $imagemeta_root_access) {
+ if (defined($imagemeta_root_access) && $imagemeta_root_access) {
if ($root_access == 1) {
my $sudoers_file_path = '/etc/sudoers';
my $sudoers_line = "$user_login_id ALL= NOPASSWD: ALL";
@@ -4950,7 +4950,7 @@ sub notify_user_console {
}
my $message = shift;
- if(!$message) {
+ if (!$message) {
notify($ERRORS{'WARNING'}, 0, "message argument was not supplied");
return;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm Tue Dec 9 21:33:44 2014
@@ -86,7 +86,7 @@ sub post_load {
return 0;
}
- if (write_currentimage_txt($self->data)){
+ if (write_currentimage_txt($self->data)) {
notify($ERRORS{'OK'}, 0, "wrote current_image.txt on $computer_short_name");
}
else {
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm Tue Dec 9 21:33:44 2014
@@ -91,17 +91,17 @@ sub clean_iptables {
my $source_file_path = "/etc/iptables.rules";
if (run_scp_command("$computer_node_name:\"$source_file_path\"", $tmpfile, $management_node_keys)) {
my @lines;
- if(open(IPTAB_TMPFILE, $tmpfile)){
+ if (open(IPTAB_TMPFILE, $tmpfile)) {
@lines = <IPTAB_TMPFILE>;
close(IPTAB_TMPFILE);
}
- foreach my $line (@lines){
+ foreach my $line (@lines) {
if ($line =~ s/-A INPUT -s .*\n//) {
}
}
#Rewrite array to tmpfile
- if(open(IPTAB_TMPFILE, ">$tmpfile")){
+ if (open(IPTAB_TMPFILE, ">$tmpfile")) {
print IPTAB_TMPFILE @lines;
close (IPTAB_TMPFILE);
}
@@ -169,20 +169,20 @@ sub clean_known_files {
}
#Remove files
- if(!(grep( /70-persistent-net.rules/ , @exclude_list ) ) ){
- if(!$self->delete_file("/etc/udev/rules.d/70-persistent-net.rules")){
+ if (!(grep( /70-persistent-net.rules/ , @exclude_list ) ) ) {
+ if (!$self->delete_file("/etc/udev/rules.d/70-persistent-net.rules")) {
notify($ERRORS{'WARNING'}, 0, "unable to remove /etc/udev/rules.d/70-persistent-net.rules");
}
}
- if(!(grep( /\/var\/log\/auth/ , @exclude_list ) ) ){
- if(!$self->execute("cp /dev/null /var/log/auth.log")){
+ if (!(grep( /\/var\/log\/auth/ , @exclude_list ) ) ) {
+ if (!$self->execute("cp /dev/null /var/log/auth.log")) {
notify($ERRORS{'WARNING'}, 0, "unable to overwrite /var/log/auth.log");
}
}
- if(!(grep( /\/var\/log\/lastlog/ , @exclude_list ) ) ){
- if(!$self->execute("cp /dev/null /var/log/lastlog")){
+ if (!(grep( /\/var\/log\/lastlog/ , @exclude_list ) ) ) {
+ if (!$self->execute("cp /dev/null /var/log/lastlog")) {
notify($ERRORS{'WARNING'}, 0, "unable to overwrite /var/log/lastlog");
}
}
@@ -487,7 +487,7 @@ sub get_firewall_configuration {
return;
}
}
- elsif($line =~ /^(\d+)\s+([A-Z]*)\s+([a-z]*)\s+(--)\s+(\S+)\s+(\S+)\s+(.*)/ig ) {
+ elsif ($line =~ /^(\d+)\s+([A-Z]*)\s+([a-z]*)\s+(--)\s+(\S+)\s+(\S+)\s+(.*)/ig ) {
my $num = $1;
my $target = $2;
@@ -499,7 +499,7 @@ sub get_firewall_configuration {
my $name;
- if (defined($port_string) && ($port_string =~ /([\s(a-zA-Z)]*)(dpt:)(\d+)/ig )){
+ if (defined($port_string) && ($port_string =~ /([\s(a-zA-Z)]*)(dpt:)(\d+)/ig )) {
$port = $3;
notify($ERRORS{'DEBUG'}, 0, "output rule: $num, $target, $protocol, $scope, $destination, $port ");
}
@@ -515,7 +515,7 @@ sub get_firewall_configuration {
}
else {
for my $sline (@$service_output) {
- if ( $sline =~ /(^[_-a-zA-Z1-9]+)\s+($port\/$protocol)\s+(.*) /ig ){
+ if ( $sline =~ /(^[_-a-zA-Z1-9]+)\s+($port\/$protocol)\s+(.*) /ig ) {
$name = $1;
}
}
@@ -579,7 +579,7 @@ sub set_static_public_address {
my $ip_configuration = $self->data->get_management_node_public_ip_configuration();
if ($ip_configuration !~ /static/i) {
- if( !$server_request_fixedIP ) {
+ if ( !$server_request_fixedIP ) {
notify($ERRORS{'WARNING'}, 0, "static public address can only be set if IP configuration is static or is a server request, current value: $ip_configuration \nserver_request_fixedIP=$server_request_fixedIP");
return;
}
@@ -610,7 +610,7 @@ sub set_static_public_address {
#Try to ping address to make sure it's available
#FIXME -- need to add other tests for checking ip_address is or is not available.
- if(_pingnode($computer_public_ip_address)) {
+ if (_pingnode($computer_public_ip_address)) {
notify($ERRORS{'WARNING'}, 0, "ip_address $computer_public_ip_address is pingable, can not assign to $computer_name ");
return;
}
@@ -620,7 +620,7 @@ sub set_static_public_address {
my $network_interfaces_file_default = "/etc/network/interfaces";
notify($ERRORS{'DEBUG'}, 0, "interface file path: $network_interfaces_file");
- if($self->execute("cp network_interfaces_file /etc/network/interfaces_orig")) {
+ if ($self->execute("cp network_interfaces_file /etc/network/interfaces_orig")) {
notify($ERRORS{'OK'}, 0, "Created backup of $network_interfaces_file");
}
@@ -643,11 +643,11 @@ sub set_static_public_address {
push(@new_interfaces_file, $l) if($l =~ /^auto lo/);
push(@new_interfaces_file, $l) if($l =~ /^\n$/);
- if($l =~ /^iface/) {
+ if ($l =~ /^iface/) {
push(@new_interfaces_file, $l) if($l !~ /$interface_name/ );
}
- if($l =~ /^iface $interface_name/) {
+ if ($l =~ /^iface $interface_name/) {
push(@new_interfaces_file, "iface $interface_name inet static\n");
push(@new_interfaces_file, "address $computer_public_ip_address\n");
push(@new_interfaces_file, "netmask $subnet_mask\n");
@@ -660,7 +660,7 @@ sub set_static_public_address {
#Clear temp file
unlink($tmpfile);
#Write array to file
- if(open(FILE, ">$tmpfile")){
+ if (open(FILE, ">$tmpfile")) {
print FILE @new_interfaces_file;
close FILE;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm Tue Dec 9 21:33:44 2014
@@ -532,7 +532,7 @@ sub notify_user_console {
}
my $message = shift;
- if(!$message) {
+ if (!$message) {
notify($ERRORS{'WARNING'}, 0, "message argument was not supplied");
return;
}
@@ -589,7 +589,7 @@ sub get_current_image_info {
my $input = shift;
- if(!defined $input) {
+ if (!defined $input) {
$input = "imagerevision_id";
}
@@ -608,7 +608,7 @@ sub get_current_image_info {
if (defined $current_image_txt_contents{imagerevision_id}) {
notify($ERRORS{'DEBUG'}, 0, "user selected content of image currently loaded on $computer_node_name: $current_image_txt_contents{current_image_name}");
- if (my $imagerevision_info = get_imagerevision_info($current_image_txt_contents{imagerevision_id})){
+ if (my $imagerevision_info = get_imagerevision_info($current_image_txt_contents{imagerevision_id})) {
$self->data->set_computer_currentimage_data($imagerevision_info->{image});
$self->data->set_computer_currentimagerevision_data($imagerevision_info);
@@ -617,7 +617,7 @@ sub get_current_image_info {
}
}
- if (defined($current_image_txt_contents{$input})){
+ if (defined($current_image_txt_contents{$input})) {
return $current_image_txt_contents{$input};
}
else {
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm Tue Dec 9 21:33:44 2014
@@ -167,7 +167,7 @@ sub pre_capture {
}
# Log off users which were created for the imaging reservation
- if (!$self->logoff_users()){
+ if (!$self->logoff_users()) {
notify($ERRORS{'WARNING'}, 0, "unable to log off all currently logged in users on $computer_node_name");
return 0;
}
@@ -445,7 +445,7 @@ sub reboot {
}
my $wait_attempt_limit = 2;
- if ($self->wait_for_reboot($wait_attempt_limit)){
+ if ($self->wait_for_reboot($wait_attempt_limit)) {
# Reboot was successful, calculate how long reboot took
my $reboot_end_time = time();
my $reboot_duration = ($reboot_end_time - $reboot_start_time);
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Tue Dec 9 21:33:44 2014
@@ -1098,7 +1098,7 @@ sub grant_access {
my $system32_path = $self->get_system32_path();
my $request_forimaging = $self->data->get_request_forimaging();
- if ($self->process_connect_methods("", 1) ){
+ if ($self->process_connect_methods("", 1) ) {
notify($ERRORS{'OK'}, 0, "processed connection methods on $computer_node_name");
}
@@ -3530,7 +3530,7 @@ sub reboot {
# Wait for the reboot to complete
my $result = $self->wait_for_reboot($total_wait_seconds, $attempt_delay_seconds, $attempt_limit);
my $reboot_duration = (time - $reboot_start_time);
- if ($result){
+ if ($result) {
# Reboot was successful, calculate how long reboot took
notify($ERRORS{'OK'}, 0, "reboot complete on $computer_node_name, took $reboot_duration seconds");
return 1;
@@ -8498,7 +8498,7 @@ sub configure_time_synchronization {
my $time_source;
my $variable_name = "timesource|" . $self->data->get_management_node_hostname();
my $variable_name_global = "timesource|global";
- if (is_variable_set($variable_name)){
+ if (is_variable_set($variable_name)) {
$time_source = get_variable($variable_name);
notify($ERRORS{'DEBUG'}, 0, "time_source is $time_source set for $variable_name");
}
@@ -11880,7 +11880,7 @@ sub notify_user_console {
}
my $message = shift;
- if(!$message) {
+ if (!$message) {
notify($ERRORS{'WARNING'}, 0, "message argument was not supplied");
return;
}
@@ -11890,7 +11890,7 @@ sub notify_user_console {
$username = $self->data->get_user_login_id();
}
my $request_forimaging = $self->data->get_request_forimaging();
- if($request_forimaging) {
+ if ($request_forimaging) {
$username = "Administrator";
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm Tue Dec 9 21:33:44 2014
@@ -195,7 +195,7 @@ sub get_next_image {
notify($ERRORS{'OK'}, 0, "$notify_prefix returning nextimage image=$next_selected_rows[0]{imagename} imageid=$next_selected_rows[0]{imageid}");
push (@ret_array, "reload", $next_selected_rows[0]{imagename}, $next_selected_rows[0]{imageid}, $next_selected_rows[0]{imagerevisionid});
#Clear next_imageid
- if(!clear_next_image_id($computer_id)){
+ if (!clear_next_image_id($computer_id)) {
notify($ERRORS{'WARNING'}, 0, "$notify_prefix failed to clear next_image_id for computerid $computer_id");
}
return @ret_array;
Modified: vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm Tue Dec 9 21:33:44 2014
@@ -138,7 +138,7 @@ sub get_next_image {
push (@next_image_ret_array, "reload", $next_selected_rows[0]{imagename}, $next_selected_rows[0]{imageid}, $next_selected_rows[0]{imagerevisionid});
#Clear next_imageid
- if(!clear_next_image_id($computer_id)){
+ if (!clear_next_image_id($computer_id)) {
notify($ERRORS{'WARNING'}, 0, "$notify_prefix failed to clear next_image_id for computerid $computer_id");
}
return @next_image_ret_array;
Modified: vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm Tue Dec 9 21:33:44 2014
@@ -92,11 +92,11 @@ sub get_next_image {
notify($ERRORS{'OK'}, 0, "$notify_prefix starting predictive_reload_level_2 for $computer_id");
#check if node is part of block reservation
- if(is_inblockrequest($computer_id)){
+ if (is_inblockrequest($computer_id)) {
notify($ERRORS{'DEBUG'}, 0, "computer id $computer_id is in blockComputers table");
my @block_ret_array = get_block_request_image_info($computer_id);
- if(defined($block_ret_array[0]) && $block_ret_array[0]){
+ if (defined($block_ret_array[0]) && $block_ret_array[0]) {
push(@ret_array, "reload", @block_ret_array);
return @ret_array;
}
@@ -106,7 +106,7 @@ sub get_next_image {
}
#If nextimageid set, set to default 0 and return the imageid
- if(defined($computer_nextimage_id) && $computer_nextimage_id) {
+ if (defined($computer_nextimage_id) && $computer_nextimage_id) {
#Get computer_nextimage_id info
my $select_nextimage = "
SELECT DISTINCT
@@ -141,7 +141,7 @@ sub get_next_image {
push(@next_image_ret_array, "reload", $next_selected_rows[0]{imagename}, $next_selected_rows[0]{imageid}, $next_selected_rows[0]{imagerevisionid});
#Clear next_imageid
- if(!clear_next_image_id($computer_id)){
+ if (!clear_next_image_id($computer_id)) {
notify($ERRORS{'WARNING'}, 0, "$notify_prefix failed to clear next_image_id for computerid $computer_id");
}
return @next_image_ret_array;
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm Tue Dec 9 21:33:44 2014
@@ -2156,16 +2156,16 @@ sub find_files {
=cut
-sub get_total_space {
+sub get_total_space {
my $self = shift;
- if (ref($self) !~ /VCL::Module/i) {
+ if (ref($self) !~ /VCL::Module/i) {
notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
return;
}
# Get the path argument
my $path = shift;
- if (!$path) {
+ if (!$path) {
notify($ERRORS{'WARNING'}, 0, "path argument was not specified");
return;
}
@@ -2179,7 +2179,7 @@ sub get_total_space {
my $datastore_info = $self->_get_datastore_info() || return;
my $total_bytes = $datastore_info->{$datastore_name}{capacity};
- if (!defined($total_bytes)) {
+ if (!defined($total_bytes)) {
notify($ERRORS{'WARNING'}, 0, "datastore $datastore_name capacity key does not exist in datastore info:\n" . format_data($datastore_info));
return;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm Tue Dec 9 21:33:44 2014
@@ -260,11 +260,11 @@ sub load {
chomp($_);
if ($_ =~ /^admin_email=(.*)/) {
$storage_admin_email = $1;
- } elsif ($_ =~ /^density_limit=(.*)/) {
+ } elsif ($_ =~ /^density_limit=(.*)/) {
$density_limit = int $1;
- } elsif ($_ =~ /^density_alert_threshold=(.*)/) {
+ } elsif ($_ =~ /^density_alert_threshold=(.*)/) {
$density_alert_threshold = $1;
- } elsif ($_ =~ /^block_copy_limit=(.*)/) {
+ } elsif ($_ =~ /^block_copy_limit=(.*)/) {
$block_copy_limit = int $1;
}
}
@@ -614,11 +614,11 @@ sub netapp_login
chomp($_);
if ($_ =~ /^ip=(.*)/) {
$ip = $1;
- } elsif ($_ =~ /^user=(.*)/) {
+ } elsif ($_ =~ /^user=(.*)/) {
$username = $1;
- } elsif ($_ =~ /^pass=(.*)/) {
+ } elsif ($_ =~ /^pass=(.*)/) {
$password = $1;
- } elsif ($_ =~ /^https=(.*)/) {
+ } elsif ($_ =~ /^https=(.*)/) {
$use_https = $1;
}
}
@@ -670,7 +670,7 @@ sub netapp_rename_dir
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -704,7 +704,7 @@ sub netapp_create_dir
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -732,7 +732,7 @@ sub netapp_read_file
#my $hex_data = ascii_to_hex($ascii_data);
my $out = $s->invoke( "file-read-file","length",1048576,"offset",0,"path",$path );
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -760,7 +760,7 @@ sub netapp_write_file
my $hex_data = ascii_to_hex($ascii_data);
my $out = $s->invoke( "file-write-file","data",$hex_data,"offset",0,"overwrite",0,"path",$path );
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -791,7 +791,7 @@ sub netapp_delete_dir
my $in = NaElement->new("file-get-file-info");
$in->child_add_string("path",$dir_path);
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'DEBUG'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -808,7 +808,7 @@ sub netapp_delete_dir
my $in = NaElement->new("file-list-directory-iter-start");
$in->child_add_string("path",$dir_path);
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -821,7 +821,7 @@ sub netapp_delete_dir
$file_request->child_add_string("tag",$tag_id);
my $file_response = $s->invoke_elem($file_request);
- if($file_response->results_status() eq "failed") {
+ if ($file_response->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -869,7 +869,7 @@ sub netapp_is_dir
my $in = NaElement->new("file-get-file-info");
$in->child_add_string("path",$dir_path);
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
#notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -903,7 +903,7 @@ sub netapp_is_file
my $in = NaElement->new("file-get-file-info");
$in->child_add_string("path",$file_path);
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
#notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -937,7 +937,7 @@ sub netapp_get_size
my $in = NaElement->new("file-get-file-info");
$in->child_add_string("path",$path);
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
#notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -968,7 +968,7 @@ sub netapp_get_vol_density
my $in = NaElement->new("volume-list-info");
$in->child_add_string("volume",$vol);
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
#notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -998,7 +998,7 @@ sub netapp_delete_empty_dir
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -1028,7 +1028,7 @@ sub netapp_delete_file
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
} else {
@@ -1118,7 +1118,7 @@ sub netapp_fileclone
my $out = $s->invoke_elem($in);
- if($out->results_status() eq "failed") {
+ if ($out->results_status() eq "failed") {
if ($out->results_errno() == 14611) {
notify($ERRORS{'DEBUG'}, 0, "Too Many Clones Currently Occuring ... will try again in $retry seconds");
sleep($retry);
@@ -1146,8 +1146,8 @@ sub netapp_fileclone
my $out = $s->invoke_elem($in);
while($out->child_get("status")->child_get("ops-info")->child_get_string("clone-state") ne "completed") {
notify($ERRORS{'DEBUG'}, 0, "Waiting for clone $dest_path to finish...");
- if($ignore_thick == 0 && $out->child_get("status")->child_get("ops-info")->child_get_string("blocks-copied") > $block_copy_limit) {
- if($out->child_get("status")->child_get("ops-info")->child_get_string("percent-done") < 99) {
+ if ($ignore_thick == 0 && $out->child_get("status")->child_get("ops-info")->child_get_string("blocks-copied") > $block_copy_limit) {
+ if ($out->child_get("status")->child_get("ops-info")->child_get_string("percent-done") < 99) {
#cancel clone operation
notify($ERRORS{'DEBUG'}, 0, "The clone $dest_path is being inneficiently copied instead of being cloned...");
notify($ERRORS{'DEBUG'}, 0, "The clone for $dest_path will now be cancelled");
@@ -1161,7 +1161,7 @@ sub netapp_fileclone
$stop_in->child_add($stop_clone_id);
# send the clone-stop request
my $stop_output = $s->invoke_elem($stop_in);
- if($stop_output->results_status() eq "failed") {
+ if ($stop_output->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $stop_output->results_reason() ."\n");
return 0;
} else {
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm Tue Dec 9 21:33:44 2014
@@ -160,7 +160,7 @@ sub unload {
return;
}
- if(!$self->delete_existing_domains()) {
+ if (!$self->delete_existing_domains()) {
return;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm Tue Dec 9 21:33:44 2014
@@ -121,7 +121,7 @@ sub unload {
my $one_computer_id = $self->_one_get_object_id("computer",$computer_name);
if ($one_computer_id) {
- if(!$self->_one_delete_vm($one_computer_id)) {
+ if (!$self->_one_delete_vm($one_computer_id)) {
return 0;
}
}
@@ -236,7 +236,7 @@ sub load {
my $one_net_id = $self->_one_get_object_id("network",'VLAN_ID='.$_);
$template->{NIC}[1]{NETWORK_ID} = $one_net_id;
}
- } else {
+ } else {
# no custom networks, add eth1 as default public;
$template->{NIC}[1]{NETWORK_ID} = $one_network_1_id;
}
@@ -386,7 +386,7 @@ sub capture {
}
# pre_capture was called with {end_state => 'on'}. Need to shutdown VM via ACPI.
- if(!$self->power_off()) {
+ if (!$self->power_off()) {
notify($ERRORS{'CRITICAL'}, 0, "Couldn't shutdown $computer_name with power_off()");
return 0;
} else {
@@ -879,7 +879,7 @@ sub _one_get_object_id {
my $data = $xml->XMLin($reply[0][1]);
- if ( (ref($data->{VM})) eq "ARRAY" ){
+ if ( (ref($data->{VM})) eq "ARRAY" ) {
foreach (@{$data->{VM}}) {
if ($_->{NAME} =~ /$o_name/) {
return $_->{ID};
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm Tue Dec 9 21:33:44 2014
@@ -383,7 +383,7 @@ sub get_image_size {
}
my $os_image_size_bytes = $output->{'image'}{'OS-EXT-IMG-SIZE:size'};
- if (!defined($os_image_size_bytes)){
+ if (!defined($os_image_size_bytes)) {
notify($ERRORS{'WARNING'}, 0, "The openstack image size for $image_name does NOT exists");
return;
}
@@ -942,7 +942,7 @@ sub _post_os_create_instance {
return;
}
my $os_instance_id = $output->{'server'}{'id'};
- if (!defined($os_instance_id)){
+ if (!defined($os_instance_id)) {
notify($ERRORS{'WARNING'}, 0, "failed to execute command to get the instance id on $computer_name");
return;
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm Tue Dec 9 21:33:44 2014
@@ -266,7 +266,7 @@ sub load {
} # start if base not exists
# If the base exists but was not registered we just need to register it
- if((!($baseisregistered)) && ($baseexists)) {
+ if ((!($baseisregistered)) && ($baseexists)) {
undef @sshcmd;
# So Oracle removed the method for registering an image with the server. Registration is now automated when media is attached to a VM. But a "read lock" error is given if you attempt to specify "-mtype multiattach" after the first attachment to a vm if the first vm is running. In order to avoid extra logic to determine if it is the first attachment during VM creation, a non-running VM is registered named "STORAGE_HOLDER" with a scsi controller named "STORAGE_HOLDER_SCSI". An image can be attached to port 0 in multiattach mode and any further attachments will default to multiattach when no mtype is specified, without the mtype arg no error is thrown. This feels more like a VBox bug to me, and I opened a bug report with Oracle.
@@ -624,7 +624,7 @@ sub capture { ## This is going to need t
=cut
-sub remove_snapshots {
+sub remove_snapshots {
my $self = shift;
if (ref($self) !~ /vbox/i) {
notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm Tue Dec 9 21:33:44 2014
@@ -1231,7 +1231,7 @@ sub _edit_nodelist {
# Image-based install or capture
$groups = "all,blade,image";
}
- elsif ($image_project eq "vcl"){
+ elsif ($image_project eq "vcl") {
$groups = "all,blade,compute";
}
else {
@@ -2263,7 +2263,7 @@ sub check_image_os {
# Change rhelX --> rhXimage, rhfcX --> fcXimage
$image_os_name_new = "$1$2image";
}
- elsif($image_os_name =~ /^(centos)([0-9])/) {
+ elsif ($image_os_name =~ /^(centos)([0-9])/) {
# Change rhelX --> rhXimage, rhfcX --> fcXimage
$image_os_name_new = "$1$2image";
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/State.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/State.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/State.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/State.pm Tue Dec 9 21:33:44 2014
@@ -288,7 +288,7 @@ sub reservation_failed {
notify($ERRORS{'OK'}, 0, "request has been deleted, setting computer state to available and exiting");
# Update the computer state to available
- if ($computer_state_name !~ /^(maintenance)/){
+ if ($computer_state_name !~ /^(maintenance)/) {
if (update_computer_state($computer_id, "available")) {
notify($ERRORS{'OK'}, 0, "$computer_short_name ($computer_id) state set to 'available'");
}
@@ -357,7 +357,7 @@ sub reservation_failed {
notify($ERRORS{'WARNING'}, 0, "unable to set request to $new_request_state_name/$request_state_name");
}
- if ($request_state_name =~ /^(new|reserved)/){
+ if ($request_state_name =~ /^(new|reserved)/) {
# Update log table ending column to failed for this request
if (update_log_ending($request_logid, "failed")) {
notify($ERRORS{'OK'}, 0, "updated log ending value to 'failed', logid=$request_logid");
@@ -376,7 +376,7 @@ sub reservation_failed {
}
# Update the computer state to failed as long as it's not currently maintenance
- if ($computer_state_name !~ /^(maintenance)/){
+ if ($computer_state_name !~ /^(maintenance)/) {
if (update_computer_state($computer_id, $new_computer_state_name)) {
notify($ERRORS{'OK'}, 0, "computer $computer_short_name ($computer_id) state set to $new_computer_state_name");
}
@@ -719,7 +719,7 @@ sub state_exit {
}
}
- if($request_state_name_old =~ /complete|timeout|deleted/) {
+ if ($request_state_name_old =~ /complete|timeout|deleted/) {
delete_computerloadlog_reservation(\@reservation_ids,0,1);
}
Modified: vcl/trunk/managementnode/lib/VCL/blockrequest.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/blockrequest.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/blockrequest.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/blockrequest.pm Tue Dec 9 21:33:44 2014
@@ -149,7 +149,7 @@ sub process {
}
#Get image info
- if ($image_info = get_image_info($blockrequest_image_id)){
+ if ($image_info = get_image_info($blockrequest_image_id)) {
$image_prettyname = $image_info->{prettyname};
}
@@ -182,14 +182,14 @@ sub process {
my $urla = $XMLRPC_URL;
my $blockAlloc_URL;
- if($urla =~ /(.*)(=xmlrpccall)/){
+ if ($urla =~ /(.*)(=xmlrpccall)/) {
$blockAlloc_URL = $1 . "=blockallocations";
}
my($allocated,$unallocated) = 0;
- while(!($completed)){
- if($loop_control < 6){
+ while (!($completed)) {
+ if ($loop_control < 6) {
$loop_control++;
notify($ERRORS{'DEBUG'}, 0, "processing blocktime_id= $blocktime_id pass $loop_control");
$xmlcall = process_block_time($blocktime_id);
@@ -203,7 +203,7 @@ sub process {
$allocated = $xmlcall->{allocated} if (defined($xmlcall->{allocated}));
$unallocated = $xmlcall->{unallocated} if (defined($xmlcall->{unallocated}));
- if($allocated >= $blockrequest_number_machines){
+ if ($allocated >= $blockrequest_number_machines) {
$completed=1;
notify($ERRORS{'OK'}, 0, "success blockTimes id $blocktime_id processed and allocated $xmlcall->{allocated} nodes \nstatus= $xmlcall->{status}");
last;
@@ -229,7 +229,7 @@ sub process {
my $subject = "VCL Block allocation results for $blockrequest_name";
my $mailstring;
- if(defined($warningmsg) || defined($errormsg) || ($allocated < $blockrequest_number_machines)){
+ if (defined($warningmsg) || defined($errormsg) || ($allocated < $blockrequest_number_machines)) {
$body .= "Problem processing block allocation \n\n";
$body .= "Block id = $blockrequest_id\n";
$body .= "Block name = $blockrequest_name\n";
@@ -244,7 +244,7 @@ sub process {
notify($ERRORS{'CRITICAL'}, 0, "$body");
- if($allocated < $blockrequest_number_machines){
+ if ($allocated < $blockrequest_number_machines) {
$subject = "VCL Block allocation warning for $blockrequest_name";
$mailstring .= << "EOF";
@@ -267,14 +267,14 @@ If you wish to cancel this session or ma
the VCL site: $blockAlloc_URL
EOF
- if(defined($owner_email)){
+ if (defined($owner_email)) {
mail($owner_email, $subject, $mailstring, $owner_affiliation_helpaddress);
}
}
}
- elsif($completed){
+ elsif ($completed) {
# Notify block request owner for given time slot has been processed.
my $mailstring .= <<"EOF";
@@ -299,7 +299,7 @@ Thank You,
VCL Team
EOF
- if(defined($owner_email)){
+ if (defined($owner_email)) {
mail($owner_email, $subject, $mailstring, $owner_affiliation_helpaddress);
}
@@ -323,7 +323,7 @@ EOF
if ($status eq "expire") {
#fork start processing
notify($ERRORS{'OK'}, 0, "Block Request $blockrequest_id has expired");
- if(udpate_block_request_status($blockrequest_id,"completed")){
+ if (udpate_block_request_status($blockrequest_id,"completed")) {
notify($ERRORS{'OK'}, 0, "Updated status of blockRequest id $blockrequest_id to completed");
}
}
@@ -332,7 +332,7 @@ EOF
} ## end elsif ($blockrequest_mode eq "end") [ if ($blockrequest_mode eq "start")
elsif ($blockrequest_mode eq "expire") {
notify($ERRORS{'OK'}, 0, "Block Request $blockrequest_id has expired");
- if(udpate_block_request_status($blockrequest_id,"completed")){
+ if (udpate_block_request_status($blockrequest_id,"completed")) {
notify($ERRORS{'OK'}, 0, "Updated status of blockRequest id $blockrequest_id to completed");
}
}
@@ -363,7 +363,7 @@ EOF
sub process_block_time {
my $blockTimesid = $_[0];
- if(!$blockTimesid){
+ if (!$blockTimesid) {
notify($ERRORS{'WARNING'}, 0, "blockTimesid argument was not passed");
return 0;
}
@@ -375,7 +375,7 @@ sub process_block_time {
my $xml_ret = xmlrpc_call(@argument_string);
my %info;
- if( ref($xml_ret) =~ /STRUCT/i){
+ if ( ref($xml_ret) =~ /STRUCT/i) {
$info{status} = $xml_ret->value->{status};
$info{allocated} = $xml_ret->value->{allocated} if(defined($xml_ret->value->{allocated})) ;
$info{unallocated} = $xml_ret->value->{unallocated} if(defined($xml_ret->value->{unallocated}));
@@ -389,7 +389,7 @@ sub process_block_time {
}
else {
notify($ERRORS{'WARNING'}, 0, "return argument XMLRPCprocessBlockTime was not a STRUCT as expected" . ref($xml_ret) );
- if(ref($xml_ret) =~ /fault/){
+ if (ref($xml_ret) =~ /fault/) {
$info{status} = "fault";
}
else {
Modified: vcl/trunk/managementnode/lib/VCL/healthcheck.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/healthcheck.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/healthcheck.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/healthcheck.pm Tue Dec 9 21:33:44 2014
@@ -147,7 +147,7 @@ sub process {
my $mn_hostname = $info->{managementnode}->{hostname};
my $last_check;
- if($powerdownstage =~ /^(available|all)$/){
+ if ($powerdownstage =~ /^(available|all)$/) {
notify($ERRORS{'WARNING'}, 0, "ALERT: powerdown stage triggered,placing MN $mn_hostname in maintenance");
if (set_managementnode_state($info->{managementnode}, "maintenance")) {
notify($ERRORS{'OK'}, 0, "Successfully set $mn_hostname into maintenance");
@@ -156,7 +156,7 @@ sub process {
notify($ERRORS{'WARNING'}, 0, "Failed to set $mn_hostname into maintenance");
}
}
- elsif($powerdownstage =~ /^restore/){
+ elsif ($powerdownstage =~ /^restore/) {
notify($ERRORS{'WARNING'}, 0, "ALERT: Environment OK: restoring state of MN $mn_hostname in available");
if (set_managementnode_state($info->{managementnode}, "available")) {
notify($ERRORS{'OK'}, 0, "Successfully set $mn_hostname into available");
@@ -249,7 +249,7 @@ sub process {
my $node_status_string = "reload";
notify($ERRORS{'OK'}, 0, "pinging node $computer_short_name ");
- if(_pingnode($computer_short_name) ){
+ if (_pingnode($computer_short_name) ) {
$node_status{ping} = 1;
# Try nmap to see if any of the ssh ports are open before attempting to run a test command
my $port_22_status = nmap_port($computer_short_name, 22) ? "open" : "closed";
@@ -284,9 +284,9 @@ sub process {
notify($ERRORS{'OK'}, 0, "ssh test: failed. port 22: $port_22_status, port 24: $port_24_status");
}
- if($sshd_status eq "on") {
+ if ($sshd_status eq "on") {
$node_status{"ssh"} = 1;
- if($computer_type eq "lab") {
+ if ($computer_type eq "lab") {
$node_status_string = "ready";
$node_status{status} = "ready";
next;
@@ -294,7 +294,7 @@ sub process {
my @currentimage_txt_contents = get_current_image_contents_noDS($computer_short_name);
foreach my $l (@currentimage_txt_contents) {
#notify($ERRORS{'OK'}, 0, "NODE l=$l");
- if( $l =~ /imagerevision_id/i ) {
+ if ( $l =~ /imagerevision_id/i ) {
chomp($l);
my ($b,$imagerevision_id) = split(/=/,$l);
$node_status{imagerevision_id} = $imagerevision_id;
@@ -307,7 +307,7 @@ sub process {
}
}
- if($node_status{imagerevision_id}) {
+ if ($node_status{imagerevision_id}) {
#Get image info using imagerevision_id as identifier
my $image_info = get_imagerevision_info($node_status{imagerevision_id},0);
$node_status{"currentimage"} = $image_info->{imagename};
@@ -340,9 +340,9 @@ sub process {
}
#check for powerdownstages
- if($powerdownstage =~ /^(available|all)$/){
+ if ($powerdownstage =~ /^(available|all)$/) {
$info->{computertable}->{$cid}->{"powerdownstage"} = $powerdownstage;
- if(powerdown_event($info->{computertable}->{$cid})){
+ if (powerdown_event($info->{computertable}->{$cid})) {
notify($ERRORS{'OK'}, 0, "Successfully powered down $computer_hostname");
}
else {
@@ -387,7 +387,7 @@ sub process {
if ($computer_type eq "lab") {
#no additional checks required for lab type
- #if(lab_investigator($info->{computertable}->{$cid})){
+ #if (lab_investigator($info->{computertable}->{$cid})) {
$node_available =1;
#}
}
@@ -501,7 +501,7 @@ sub powerdown_event {
#If blade or vm and available|failed|maintenance - simply power-off
#If blade and vmhostinuse - check vms, if available power-down all
- if(($computer_type =~ /blade/) && ($computer_state =~ /^(available|failed|maintenance)/)){
+ if (($computer_type =~ /blade/) && ($computer_state =~ /^(available|failed|maintenance)/)) {
notify($ERRORS{'OK'}, 0, "calling provision module $provisioning_perl_package power_off routine $computer_short_name");
eval "use $provisioning_perl_package";
@@ -512,7 +512,7 @@ sub powerdown_event {
}
my $power_off_status = eval "&$provisioning_perl_package" . '::power_off($computer_short_name);';
notify($ERRORS{'OK'}, 0, "$power_off_status ");
- if($power_off_status){
+ if ($power_off_status) {
notify($ERRORS{'OK'}, 0, "SUCCESS powered_off $computer_short_name");
return 1;
}
@@ -551,7 +551,7 @@ sub _virtualmachine_investigator {
my $nodestatus_vmstate = $self->{node_status}->{vmstate};
my $nodestatus_image_match = $self->{node_status}->{image_match};
- if($nodestatus_vmstate =~ /off/){
+ if ($nodestatus_vmstate =~ /off/) {
# Ok for node to be off
$retval =1;
return $retval;
Modified: vcl/trunk/managementnode/lib/VCL/image.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/image.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/image.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/image.pm Tue Dec 9 21:33:44 2014
@@ -555,12 +555,12 @@ sub setup_capture_base_image {
my $image_is_virtual = 0;
print "\nTesting api call\n";
- if($self->setup_test_rpc_xml(0)) {
+ if ($self->setup_test_rpc_xml(0)) {
print "VCL API call successful\n\n";
}
# Is vcld service running
- if(!run_command('service vcld restart')){
+ if (!run_command('service vcld restart')) {
print "ERROR: Unable to confirm vcld is running, Attempted to use service vcld restart\n";
return;
}
@@ -640,7 +640,7 @@ sub setup_capture_base_image {
if ($computer_provisioning_module_name !~ /xcat/i) {
$image_is_virtual = 1;
#should have a vmhost assigned
- if ($computer_info{$computer_id}{vmhostid}){
+ if ($computer_info{$computer_id}{vmhostid}) {
$vmhost_name = $computer_info{$computer_id}{vmhost}{computer}{SHORTNAME};
print "VM host name: $vmhost_name\n";
print "VM host profile: $computer_info{$computer_id}{vmhost}{vmprofile}{profilename}\n";
@@ -721,7 +721,7 @@ sub setup_capture_base_image {
# if 0 selected, delete all reservations related to $computer_node_name
# Set $computer_node_name to available, proceed with questions
my $epoch_time = convert_to_epoch_seconds;
- if ($chosen_request_id == 0 ){
+ if ($chosen_request_id == 0 ) {
delete $existing_requests_array_choices{0};
foreach my $request_id_del (sort keys %existing_requests_array_choices) {
@@ -744,14 +744,14 @@ sub setup_capture_base_image {
print "Removed reservation id $request_id_del for $del_image_name\n";
if (update_image_name($del_image_id, $del_imagerevision_id, $new_image_name, $new_prettyimage_name)) {
}
- if (update_computer_state($computer_id, "available")){
+ if (update_computer_state($computer_id, "available")) {
print "Set $computer_node_name to available state\n";
}
}
}
}
# Elseif a request id is choosen. set $computer_node_name to available, test ssh access, restart image capture
- if ($chosen_request_id){
+ if ($chosen_request_id) {
$request_id = $chosen_request_id;
$reservation_id = $existing_requests_array_choices{$chosen_request_id}{reservation_id};
if (reservation_being_processed($chosen_request_id)) {
@@ -775,7 +775,7 @@ sub setup_capture_base_image {
return;
}
}
- if (update_computer_state($computer_id, "available")){
+ if (update_computer_state($computer_id, "available")) {
print "Set $computer_node_name to available state\n";
}
$chosen_prettyname = $existing_requests_array_choices{$chosen_request_id}{prettyname};
@@ -994,7 +994,7 @@ MONITOR_LOG_OUTPUT:
while (my $output = <COMMAND>) {
if ($output =~ /$reservation_id/) {
print $output;
- if ($output =~ /complete/i ){
+ if ($output =~ /complete/i ) {
last;
}
}
Modified: vcl/trunk/managementnode/lib/VCL/inuse.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/inuse.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/inuse.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/inuse.pm Tue Dec 9 21:33:44 2014
@@ -395,7 +395,7 @@ sub user_connected {
}
# If duration is >= 24 hrs set as connected and return
- if($request_duration_hrs >= $ignore_connections_gte ) {
+ if ($request_duration_hrs >= $ignore_connections_gte ) {
notify($ERRORS{'OK'}, 0, "reservation duration is $request_duration_hrs hrs is >= to ignore_connections setting $ignore_connections_gte hrs, skipping inuse checks");
insertloadlog($reservation_id, $computer_id, "connected", "user connected to $computer_short_name");
return 1;
@@ -523,7 +523,7 @@ EOF
# Send message to machine
if ($computer_type =~ /blade|virtualmachine/) {
- if ($image_os_type =~ /osx/){
+ if ($image_os_type =~ /osx/) {
# Notify via oascript
notify_via_oascript($computer_short_name, $user_login_id, $short_message);
}
@@ -782,7 +782,7 @@ sub _notify_user_request_ended {
my $subject;
my $message;
- if(!$request_forimaging) {
+ if (!$request_forimaging) {
$subject = "VCL -- End of reservation";
$message = <<"EOF";
Modified: vcl/trunk/managementnode/lib/VCL/reclaim.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/reclaim.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/reclaim.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/reclaim.pm Tue Dec 9 21:33:44 2014
@@ -107,7 +107,7 @@ sub process {
# Remove related fixedIPsr variable, if it exists
if ($server_request_id) {
my $variable_name = "fixedIPsr" . $server_request_id;
- if (is_variable_set($variable_name)){
+ if (is_variable_set($variable_name)) {
#Delete from variable table.
my $delete_sql_statement = "DELETE variable FROM variable WHERE name = '$variable_name' ";
if (database_execute($delete_sql_statement)) {
@@ -250,9 +250,9 @@ sub insert_reload_and_exit {
# Retrieve next image
my ($action, $next_image_name, $next_image_id, $next_imagerevision_id) = $self->data->get_next_image_dataStructure();
- if($action =~ /unload/i) {
- if($self->provisioner->can("unload")){
- if($self->provisioner->unload()) {
+ if ($action =~ /unload/i) {
+ if ($self->provisioner->can("unload")) {
+ if ($self->provisioner->unload()) {
if (update_computer_imagename($computer_id, 'noimage')) {
notify($ERRORS{'DEBUG'}, 0, "set computer $computer_shortname current image to 'noimage'");
}
@@ -263,7 +263,7 @@ sub insert_reload_and_exit {
}
else {
- #elsif( $action =~ /reload/i ){
+ #elsif ( $action =~ /reload/i ) {
if (!$next_image_name || !$next_image_id || !$next_imagerevision_id) {
notify($ERRORS{'WARNING'}, 0, "predictor module did not return required information, calling get_next_image_default from utils");
($next_image_name, $next_image_id, $next_imagerevision_id) = get_next_image_default($computer_id);
Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1644193&r1=1644192&r2=1644193&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Tue Dec 9 21:33:44 2014
@@ -673,7 +673,7 @@ sub notify {
elsif ($error == 2) {
my $caller_trace = get_caller_trace(15);
$log_message = "\n---- CRITICAL ---- \n$log_message\n$caller_trace\n\n";
- if($sysadmin) {
+ if ($sysadmin) {
# Assemble the e-mail message body
$body = <<"END";
@@ -891,15 +891,15 @@ sub check_endtimenotice_interval {
#flag on: 2 & 1 week; 2,1 day, 1 hour, 30,15,10,5 minutes
#ignore over 2weeks away
- if($diff_weeks >= 2){
+ if ($diff_weeks >= 2) {
return 0;
}
#2 week: between 14 days and a 14 day -6 minutes window
- elsif($Total_days >= 13 && $diff_hours >= 23 && $diff_minutes >= 55){
+ elsif ($Total_days >= 13 && $diff_hours >= 23 && $diff_minutes >= 55) {
return "2 weeks";
}
#Ignore: between 7 days and 14 day - 6 minute window
- elsif($Total_days >=7) {
+ elsif ($Total_days >=7) {
return 0;
}
# 1 week notice: between 7 days and a 7 day -6 minute window
@@ -911,11 +911,11 @@ sub check_endtimenotice_interval {
return 0;
}
# 2 day notice: between 2 days and a 2 day -6 minute window
- elsif($Total_days >= 1 && $diff_hours >= 23 && $diff_minutes >= 55) {
+ elsif ($Total_days >= 1 && $diff_hours >= 23 && $diff_minutes >= 55) {
return "2 days";
}
# 1 day notice: between 1 days and a 1 day -6 minute window
- elsif($Total_days >= 0 && $diff_hours >= 23 && $diff_minutes >= 55) {
+ elsif ($Total_days >= 0 && $diff_hours >= 23 && $diff_minutes >= 55) {
return "24 hours";
}
@@ -1127,7 +1127,7 @@ sub check_time {
return 0;
}
}
- elsif($reservation_cnt > 1 ){
+ elsif ($reservation_cnt > 1 ) {
my $cluster_inuse_check_time = ($ENV{management_node_info}->{CLUSTER_INUSE_CHECK} * -1);;
if ($lastcheck_diff_minutes <= $cluster_inuse_check_time) {
return "poll";
@@ -2121,7 +2121,7 @@ sub check_ssh {
$port = 22;
}
- if(nmap_port($node,$port)){
+ if (nmap_port($node,$port)) {
notify($ERRORS{'OK'}, $log, " $node ssh port $port open");
return 1;
}
@@ -2394,7 +2394,7 @@ sub getpw {
$b .= $a[rand @a ];
}
- if($include_special_chars) {
+ if ($include_special_chars) {
$b .= $spchars[rand @spchars];
}
@@ -2528,7 +2528,7 @@ sub getusergroupmembers {
for (@selected_rows) {
my %hash = %{$_};
- if(!defined($hash{uid})){
+ if (!defined($hash{uid})) {
$hash{uid} = 0;
}
push(@retarray, "$hash{unityid}:$hash{uid}:$hash{id}");
@@ -2958,7 +2958,7 @@ sub database_execute {
my $sql_warning_count = $statement_handle->{'mysql_warning_count'};
$statement_handle->finish;
$dbh->disconnect if !defined $ENV{dbh};
- if($sql_insertid) {
+ if ($sql_insertid) {
return $sql_insertid;
}
else {
@@ -3160,7 +3160,7 @@ EOF
$request_info->{checkuser} = 0;
$request_info->{reservation}{$reservation_id}{serverrequest}{ALLOW_USERS} = $request_info->{user}{unityid};
}
- elsif ($request_info->{DURATION} >= (60 * 60 * 24) ){
+ elsif ($request_info->{DURATION} >= (60 * 60 * 24) ) {
#notify($ERRORS{'DEBUG'}, 0, "request length > 24 hours, disabling user checks");
$request_info->{checkuser} = 0;
}
@@ -3208,15 +3208,15 @@ EOF
sub set_managementnode_state {
my ($mninfo, $state) = @_;
- if(!(defined($state))){
+ if (!(defined($state))) {
notify($ERRORS{'WARNING'}, 0, "state was not specified");
return ();
}
- if(!(defined($mninfo->{hostname}))){
+ if (!(defined($mninfo->{hostname}))) {
notify($ERRORS{'WARNING'}, 0, "management node hostname was not specified");
return ();
}
- if(!(defined($mninfo->{id}))){
+ if (!(defined($mninfo->{id}))) {
notify($ERRORS{'WARNING'}, 0, "management node ID was not specified");
return ();
}
@@ -3442,7 +3442,7 @@ AND module.id = OS.moduleid
AND
EOF
- if ($image_identifier =~ /^\d+$/){
+ if ($image_identifier =~ /^\d+$/) {
$select_statement .= "image.id = $image_identifier";
}
else {
@@ -3549,7 +3549,7 @@ WHERE
EOF
# Check input value - complete select_statement
- if($imagerevision_identifier =~ /^\d/){
+ if ($imagerevision_identifier =~ /^\d/) {
$select_statement .= "imagerevision.id = '$imagerevision_identifier'";
}
else{
@@ -3624,7 +3624,7 @@ AND
EOF
# Check input value - complete select_statement
- if($image_identifier =~ /^\d/){
+ if ($image_identifier =~ /^\d/) {
$select_statement .= "imagerevision.imageid = '$image_identifier'";
}
else {
@@ -4431,12 +4431,12 @@ sub write_currentimage_txt {
#Make sure currentimage.txt writable
my $chown_command = "chown root currentimage.txt; chmod 777 currentimage.txt";
- if (run_ssh_command($computer_node_name, $image_identity, $chown_command)){
+ if (run_ssh_command($computer_node_name, $image_identity, $chown_command)) {
notify($ERRORS{'OK'}, 0, "updated ownership and permissions on currentimage.txt");
}
my $command;
- if($image_os_type =~ /osx/i) {
+ if ($image_os_type =~ /osx/i) {
$command = 'echo "';
}
else {
@@ -4693,7 +4693,7 @@ sub update_computer_imagename {
#get computer infomation based on imagename
my $imagerevision_info;
- if( $imagerevision_info = get_imagerevision_info($imagename)){
+ if ( $imagerevision_info = get_imagerevision_info($imagename)) {
notify($ERRORS{'DEBUG'}, 0, "successfully retreived image info for $imagename");
}
else{
@@ -4704,7 +4704,7 @@ sub update_computer_imagename {
my $image_id = $imagerevision_info->{imageid};
my $imagerevision_id = $imagerevision_info->{id};
- if(update_currentimage($computerid, $image_id, $imagerevision_id)){
+ if (update_currentimage($computerid, $image_id, $imagerevision_id)) {
notify($ERRORS{'DEBUG'}, 0, "successfully updated computerid= $computerid image_id= $image_id imagerevision_id= $imagerevision_id");
return 1;
}
@@ -5470,7 +5470,7 @@ SET
image.name = \'$new_image_name\',
EOF
- if(defined($new_image_pretty_name) ) {
+ if (defined($new_image_pretty_name) ) {
$update_statement .= <<EOF;
image.prettyname = \'$new_image_pretty_name\',
EOF
@@ -5581,7 +5581,7 @@ sub delete_computerloadlog_reservation {
$reservation_id_string = $reservation_id_argument;
}
- if(!defined($immediate)){
+ if (!defined($immediate)) {
$immediate =0;
}
@@ -6109,7 +6109,7 @@ sub switch_state {
my $computer_state_name_old = $request_data->{reservation}{$reservation_id}{computer}{state}{name};
my $computer_shortname = $request_data->{reservation}{$reservation_id}{computer}{SHORTNAME};
- if($request_state_name_old eq 'reload'){
+ if ($request_state_name_old eq 'reload') {
$request_logid = 0;
}
@@ -6347,7 +6347,7 @@ sub get_management_node_blockrequests {
if ($key =~ /blockRequest_/) {
$blockrequests{$blockrequest_id}{$original_key} = $value;
- if($key =~ /_groupid/){
+ if ($key =~ /_groupid/) {
$blockrequests{$blockrequest_id}{groupname} = get_group_name($value);
}
}
@@ -6386,7 +6386,7 @@ sub get_computers_controlled_by_mn {
my $management_node_hostname = $managementnode{hostname};
# Collect resource group this management node is a member of
- if($info{managementnode}{resoucegroups} = get_resource_groups($management_node_resourceid)){
+ if ($info{managementnode}{resoucegroups} = get_resource_groups($management_node_resourceid)) {
notify($ERRORS{'DEBUG'}, $LOGFILE, "retrieved management node resource groups from database");
}
else {
@@ -6395,21 +6395,21 @@ sub get_computers_controlled_by_mn {
}
# Collect resource group management node grpcan control
- foreach my $mresgrp_id (keys %{$info{managementnode}{resoucegroups}} ) {
+ foreach my $mresgrp_id (keys %{$info{managementnode}{resoucegroups}} ) {
my $grp_id = $info{managementnode}{resoucegroups}{$mresgrp_id}{groupid};
notify($ERRORS{'DEBUG'}, $LOGFILE, "grp_id = $grp_id ");
- if($info{manageable_resoucegroups}{$mresgrp_id} = get_managable_resource_groups($grp_id)){
+ if ($info{manageable_resoucegroups}{$mresgrp_id} = get_managable_resource_groups($grp_id)) {
notify($ERRORS{'DEBUG'}, $LOGFILE, "retrieved manageable resource groups from database for mresgrp_id= $grp_id groupname= $info{managementnode}{resoucegroups}{$mresgrp_id}{groupname}");
foreach my $id (keys %{ $info{manageable_resoucegroups}{$grp_id} } ) {
my $computer_group_id = $info{manageable_resoucegroups}{$grp_id}{$id}{groupid};
- if($info{"manageable_computer_grps"}{$id}{"members"} = get_computer_grp_members($computer_group_id) ){
+ if ($info{"manageable_computer_grps"}{$id}{"members"} = get_computer_grp_members($computer_group_id) ) {
notify($ERRORS{'DEBUG'}, $LOGFILE, "retrieved computers from computer groupname= $info{manageable_resoucegroups}{$grp_id}{$id}{groupname}");
}
- else{
+ else{
notify($ERRORS{'DEBUG'}, $LOGFILE, "no computers in computer groupid= $computer_group_id}");
delete $info{manageable_resoucegroups}{$grp_id}{$id};
}
@@ -6424,9 +6424,9 @@ sub get_computers_controlled_by_mn {
#Build master list of computerids
my %computer_list;
- foreach my $computergroup (keys %{ $info{manageable_computer_grps}}){
- foreach my $computerid (keys %{ $info{manageable_computer_grps}{$computergroup}{members} }){
- if ( !(exists $computer_list{$computerid}) ){
+ foreach my $computergroup (keys %{ $info{manageable_computer_grps}}) {
+ foreach my $computerid (keys %{ $info{manageable_computer_grps}{$computergroup}{members} }) {
+ if ( !(exists $computer_list{$computerid}) ) {
# add to return list
$computer_list{$computerid}{"computer_id"}=$computerid;
}
@@ -6450,7 +6450,7 @@ sub get_computers_controlled_by_mn {
sub get_resource_groups {
my ($resource_id) = @_;
- if(!defined($resource_id)){
+ if (!defined($resource_id)) {
notify($ERRORS{'WARNING'}, $LOGFILE, "resource_id was not supplied");
return 0;
}
@@ -6503,7 +6503,7 @@ sub get_resource_groups {
sub get_managable_resource_groups {
my ($managing_resgrp_id) = @_;
- if(!defined($managing_resgrp_id)){
+ if (!defined($managing_resgrp_id)) {
notify($ERRORS{'WARNING'}, $LOGFILE, "managing_resgrp_id resource_id was not supplied");
return 0;
}
@@ -6554,7 +6554,7 @@ sub get_managable_resource_groups {
sub get_computer_grp_members {
my ($computer_grp_id) = @_;
- if(!defined($computer_grp_id)){
+ if (!defined($computer_grp_id)) {
notify($ERRORS{'WARNING'}, $LOGFILE, "computer_grp_id resource_id was not supplied");
return 0;
}
@@ -6844,7 +6844,7 @@ sub get_group_name {
my ($group_id) = @_;
- if(!defined($group_id)){
+ if (!defined($group_id)) {
notify($ERRORS{'WARNING'}, $LOGFILE, "group_id was not supplied");
return 0;
}
@@ -6898,7 +6898,7 @@ EOF
sub get_computer_info {
my ($computer_identifier, $no_cache) = @_;
- if (!defined($computer_identifier)){
+ if (!defined($computer_identifier)) {
notify($ERRORS{'WARNING'}, 0, "computer identifier argument was not supplied");
return;
}
@@ -7119,7 +7119,7 @@ EOF
sub get_computer_nathost_info {
my ($computer_identifier, $no_cache) = @_;
- if (!defined($computer_identifier)){
+ if (!defined($computer_identifier)) {
notify($ERRORS{'WARNING'}, 0, "computer identifier argument was not supplied");
return;
}
@@ -7551,7 +7551,7 @@ sub get_reservation_request_info {
sub get_computer_ids {
my ($computer_identifier) = @_;
- if(!defined($computer_identifier)){
+ if (!defined($computer_identifier)) {
notify($ERRORS{'WARNING'}, $LOGFILE, "computer identifier argument was not supplied");
return;
}
@@ -11353,11 +11353,11 @@ EOF
my @selected_rows = database_select($select_statement);
# Check to make 1 sure row was returned
- if (!@selected_rows){
+ if (!@selected_rows) {
notify($ERRORS{'DEBUG'}, 0, "variable is NOT set: $variable_name");
return 0;
}
- elsif (@selected_rows > 1){
+ elsif (@selected_rows > 1) {
notify($ERRORS{'WARNING'}, 0, "unable to get value of variable '$variable_name', multiple rows exist in the database for variable:\n" . format_data(\@selected_rows));
return;
}
@@ -11424,11 +11424,11 @@ EOF
my @selected_rows = database_select($select_statement);
# Check to make 1 sure row was returned
- if (!@selected_rows){
+ if (!@selected_rows) {
notify($ERRORS{'OK'}, 0, "variable '$variable_name' is not set in the database") if $show_warnings;
return 0;
}
- elsif (@selected_rows > 1){
+ elsif (@selected_rows > 1) {
notify($ERRORS{'WARNING'}, 0, "unable to get value of variable '$variable_name', multiple rows exist in the database for variable:\n" . format_data(\@selected_rows));
return;
}