Author: fapeeler
Date: Mon Aug  4 18:42:26 2014
New Revision: 1615723

URL: http://svn.apache.org/r1615723
Log:
VCL-736

Improvements to notify_user_endtime.


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

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=1615723&r1=1615722&r2=1615723&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm Mon Aug  4 
18:42:26 2014
@@ -512,6 +512,57 @@ sub firewall_compare_update {
        
        return 1;
 }
+
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 notify_user_console
+
+ Parameters  : message, username(optional)
+ Returns     : boolean
+ Description : Send a message to the user on the console
+
+=cut
+
+sub notify_user_console {
+       my $self = shift;
+       if (ref($self) !~ /Module/i) {
+               notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a 
function, it must be called as a class method");
+               return;
+       }
+
+       my $message = shift;
+       if(!$message) {
+               notify($ERRORS{'WARNING'}, 0, "message argument was not 
supplied");
+               return;
+       }
+
+       my $username = shift;
+       if (!$username) {
+          $username = $self->data->get_user_login_id();
+       }
+
+       my $computer_node_name = $self->data->get_computer_node_name();
+
+       my $cmd = "echo $message \| write $username";
+       my ($exit_status, $output) = $self->execute({
+                node => $computer_node_name,
+                command => $cmd,
+                display_output => 0,
+                timeout => 30,
+                max_attempts => 2,
+                port => 24,
+                user => "vclstaff"
+               });
+       if (!defined($output)) {
+               notify($ERRORS{'WARNING'}, 0, "failed to execute command to 
determine if the '$cmd' shell command exists on $computer_node_name");
+               return;
+       }
+       else {
+               notify($ERRORS{'DEBUG'}, 0, "executed command to determine if 
the '$cmd' shell command exists on $computer_node_name");
+               return 1;
+       }
+}
 #/////////////////////////////////////////////////////////////////////////////
 
 1;

Modified: vcl/trunk/managementnode/lib/VCL/inuse.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/inuse.pm?rev=1615723&r1=1615722&r2=1615723&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/inuse.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/inuse.pm Mon Aug  4 18:42:26 2014
@@ -528,19 +528,11 @@ EOF
                        $user_login_id= "administrator" if($request_forimaging);
                        notify_via_msg($computer_short_name, $user_login_id, 
$short_message);
                }
-               elsif ($image_os_type =~ /linux/){
-                       # Notify via wall
-                       notify_via_wall($computer_short_name, $user_login_id, 
$short_message, $image_os_name, $computer_type);
-               }
                elsif ($image_os_type =~ /osx/){
         # Notify via oascript
         notify_via_oascript($computer_short_name, $user_login_id, 
$short_message);
      }
        } ## end if ($computer_type =~ /blade|virtualmachine/)
-       elsif ($computer_type eq "lab") {
-               # Notify via wall
-               notify_via_wall($computer_public_ip_address, $user_login_id, 
$short_message, $image_os_name, $computer_type);
-       }
        
        # Send IM
        if ($user_imtype_name ne "none") {
@@ -693,15 +685,7 @@ EOF
                        $user_login_id= "administrator" if($request_forimaging);
                        notify_via_msg($computer_short_name, $user_login_id, 
$short_message);
                }
-               elsif ($image_os_type =~ /linux/){
-                       # Notify via wall
-                       notify_via_wall($computer_short_name, $user_login_id, 
$short_message, $image_os_name, $computer_type);
-               }
        } ## end if ($computer_type =~ /blade|virtualmachine/)
-       elsif ($computer_type eq "lab") {
-               # Notify via wall
-               notify_via_wall($computer_public_ip_address, $user_login_id, 
$short_message, $image_os_name, $computer_type);
-       }
        
        return 1;
 } ## end sub _notify_user_disconnect


Reply via email to