Author: fapeeler
Date: Fri Aug  6 15:00:14 2010
New Revision: 983008

URL: http://svn.apache.org/viewvc?rev=983008&view=rev
Log:
VCL-224

moved sysadmin and sharedMailBox email addresses to the management node table

Modified:
    incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf
    incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
    incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm
    incubator/vcl/trunk/managementnode/lib/VCL/image.pm
    incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
    incubator/vcl/trunk/mysql/vcl.sql

Modified: incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf?rev=983008&r1=983007&r2=983008&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf (original)
+++ incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf Fri Aug  6 15:00:14 
2010
@@ -94,30 +94,12 @@ enable_mysql_ssl=no
 #mysql_ssl_cert: Path to MySQL certificate file
 mysql_ssl_cert=/etc/vcl/cert/my_ca.crt
 
-
-# sysadmin: system administrator email list
-# list of email addresses to be used for critical notices regarding failures 
or problems
-# optional, but not recommended to leave blank
-# Format: comma delimited list
-# Example: john_...@someschool.edu,sysadm...@vcl.someschool.edu
-sysadmin=
-
 #Sendmail envelope sender -- Return-path
 #The return-path should be set if you want email delivery failures to go
 #to a common place
 #set this to a known working address that would recieve mail like 
b...@yourdomain.com
 RETURNPATH=
 
-# shared mailbox - 
-#   address of a shared mailbox for copies of all notices sent to users
-#   optional
-#   leave empty or comment out to disable
-#   depending on user base this mailbox can grow quite large
-# 
-# users are sent email notices regarding their reservations for new
-# reservations, upcoming timeouts and image creations 
-sharedmailbox=
-
 # default from email address for end-user notifications if not listed in
 # affilation
 # database table - normally this would be a list or a help system - but

Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=983008&r1=983007&r2=983008&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Fri Aug  6 
15:00:14 2010
@@ -466,6 +466,9 @@ $SUBROUTINE_MAPPINGS{management_node_pub
 #$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_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}';

Modified: incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm?rev=983008&r1=983007&r2=983008&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm Fri Aug  6 
15:00:14 2010
@@ -543,6 +543,8 @@ sub _image_revision_check {
 
 sub send_report {
        my ($hck) = @_;
+       
+       my $sysadmin_email = $ENV{management_node_info}{SYSADMIN_EMAIL};
 
        #notify($ERRORS{'OK'},$LOG,"$hck->{globalmsg}->{body}\n\n 
$hck->{globalmsg}->{failedbody}\n");
        if (defined($hck->{computercount})) {
@@ -572,7 +574,7 @@ sub send_report {
                $hck->{globalmsg}->{body} .= "\nAll nodes report ok";
 
        }
-       mail($SYSADMIN, "VCL node monitoring report", 
"$hck->{globalmsg}->{body}");
+       mail($sysadmin_email, "VCL node monitoring report", 
"$hck->{globalmsg}->{body}");
 } ## end sub send_report
 
 #/////////////////////////////////////////////////////////////////////////////

Modified: incubator/vcl/trunk/managementnode/lib/VCL/image.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/image.pm?rev=983008&r1=983007&r2=983008&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/image.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/image.pm Fri Aug  6 15:00:14 2010
@@ -104,6 +104,7 @@ sub process {
        my $computer_type              = $self->data->get_computer_type();
        my $computer_shortname         = $self->data->get_computer_short_name();
        my $managementnode_shortname   = 
$self->data->get_management_node_short_name();
+       my $sysadmin_mail_address      = 
$self->data->get_management_node_sysadmin_email();
 
        # Notify administrators that image creation is starting
        my $body = <<"END";
@@ -128,7 +129,7 @@ Computer name: $computer_shortname
 
 Use Sysprep: $imagemeta_sysprep
 END
-       mail($SYSADMIN, "VCL IMAGE Creation Started: $image_name", $body, 
$affiliation_helpaddress);
+       mail($sysadmin_mail_address, "VCL IMAGE Creation Started: $image_name", 
$body, $affiliation_helpaddress);
 
        # Make sure image does not exist in the repository
        my $image_already_exists = $self->provisioner->does_image_exist();
@@ -300,6 +301,7 @@ sub reservation_successful {
        my $computer_type              = $self->data->get_computer_type();
        my $computer_shortname         = $self->data->get_computer_short_name();
        my $managementnode_shortname   = 
$self->data->get_management_node_short_name();
+       my $sysadmin_mail_address      = 
$self->data->get_management_node_sysadmin_email();
 
        # Send image creation successful email to user
        my $body_user = <<"END";
@@ -314,7 +316,7 @@ VCL Team
 END
        mail($user_email, "VCL -- $image_prettyname Image Creation Succeeded", 
$body_user, $affiliation_helpaddress);
 
-       # Send mail to SYSADMIN
+       # Send mail to $sysadmin_mail_address
        my $body_admin = <<"END";
 VCL Image Creation Completed
 
@@ -339,7 +341,7 @@ Computer name: $computer_shortname
 Use Sysprep: $imagemeta_sysprep
 END
 
-       mail($SYSADMIN, "VCL IMAGE Creation Completed: $image_name", 
$body_admin, $affiliation_helpaddress);
+       mail($sysadmin_mail_address, "VCL IMAGE Creation Completed: 
$image_name", $body_admin, $affiliation_helpaddress);
 
        # Insert reload request data into the datbase
        if (insert_reload_request($request_data)) {
@@ -382,6 +384,7 @@ sub reservation_failed {
        my $computer_type              = $self->data->get_computer_type();
        my $computer_shortname         = $self->data->get_computer_short_name();
        my $managementnode_shortname   = 
$self->data->get_management_node_short_name();
+       my $sysadmin_mail_address      = 
$self->data->get_management_node_sysadmin_email();
 
        # Image process failed
        notify($ERRORS{'CRITICAL'}, 0, "$image_name image creation failed");
@@ -409,7 +412,7 @@ VCL Team
 END
        mail($user_email, "VCL -- NOTICE DELAY Image Creation 
$image_prettyname", $body_user, $affiliation_helpaddress);
 
-       # Send mail to SYSADMIN
+       # Send mail to $sysadmin_mail_address
        my $body_admin = <<"END";
 VCL Image Creation Failed
 
@@ -433,7 +436,7 @@ Computer name: $computer_shortname
 Use Sysprep: $imagemeta_sysprep
 END
 
-       mail($SYSADMIN, "VCL -- NOTICE FAILED Image Creation 
$image_prettyname", $body_admin, $affiliation_helpaddress);
+       mail($sysadmin_mail_address, "VCL -- NOTICE FAILED Image Creation 
$image_prettyname", $body_admin, $affiliation_helpaddress);
 
        # Update the request state to maintenance, laststate to image
        if (update_request_state($request_id, "maintenance", "image")) {

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=983008&r1=983007&r2=983008&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Fri Aug  6 15:00:14 2010
@@ -225,7 +225,6 @@ our @EXPORT = qw(
   $WINDOWS_ROOT_PASSWORD
   $SERVER
   $SETUP_MODE
-  $SYSADMIN
   $TOOLS
   $VERBOSE
   $WRTPASS
@@ -245,7 +244,7 @@ INIT {
        our ($JABBER, $jabServer, $jabUser, $jabPass, $jabResource, $jabPort) = 
0;
        our ($LOGFILE, $PIDFILE, $PROCESSNAME);
        our ($DATABASE, $SERVER, $WRTUSER, $WRTPASS, $LockerRdUser, $rdPass) = 
0;
-       our ($SYSADMIN, $SHARED_MAILBOX, $DEFAULTHELPEMAIL, $RETURNPATH) = 0;
+       our ($DEFAULTHELPEMAIL, $RETURNPATH) = 0;
        our ($XCATROOT) = 0;
        our ($FQDN)     = 0;
        our ($MYSQL_SSL,       $MYSQL_SSL_CERT);
@@ -383,21 +382,11 @@ INIT {
                                $MYSQL_SSL_CERT = $1;
                        }
        
-                       #Sysadmin list
-                       if ($l =~ /^sysadmin=([,-...@a-za-z0-9_]*)/) {
-                               $SYSADMIN = $1;
-                       }
-
                        #Sendmail Envelope Sender 
                        if ($l =~ /^RETURNPATH=([,-...@a-za-z0-9_]*)/) {
                                $RETURNPATH = $1;
                        }
 
-                       #sharedmailbox
-                       if ($l =~ /^sharedmailbox=([,-...@a-za-z0-9_]*)/) {
-                               $SHARED_MAILBOX = $1;
-                       }
-
                        #jabber - stuff
                        if ($l =~ /^jabber=(yes)/) {
                                $JABBER = 1;
@@ -490,7 +479,7 @@ our ($JABBER, $PROCESSNAME);
 our %ERRORS = ('DEPENDENT' => 4, 'UNKNOWN' => 3, 'OK' => 0, 'WARNING' => 1, 
'CRITICAL' => 2, 'MAILMASTERS' => 5, 'DEBUG' => 6);
 our ($LockerWrtUser, $wrtPass,  $database,       $server);
 our ($jabServer,     $jabUser,  $jabPass,        $jabResource, $jabPort);
-our ($vcldquerykey,  $SYSADMIN, $SHARED_MAILBOX, 
$DEFAULTHELPEMAIL,$RETURNPATH);
+our ($vcldquerykey, $DEFAULTHELPEMAIL,$RETURNPATH);
 our ($LOGFILE, $PIDFILE, $VCLDRPCQUERYKEY);
 our ($SERVER, $DATABASE, $WRTUSER, $WRTPASS);
 our ($MYSQL_SSL,       $MYSQL_SSL_CERT);
@@ -596,6 +585,18 @@ sub notify {
        # Just return if DEBUG and verbose isn't enabled
        return if ($error == 6 && !$VERBOSE);
 
+       # Confirm sysadmin address exists
+       my $sysadmin = 0;
+       if(defined($ENV{management_node_info}{SYSADMIN_EMAIL}) && 
$ENV{management_node_info}{SYSADMIN_EMAIL}){
+               $sysadmin = $ENV{management_node_info}{SYSADMIN_EMAIL};
+       }
+       
+       # Confirm shared mail box exists
+       my $shared_mail_box = 0;
+       if(defined($ENV{management_node_info}{SHARED_EMAIL_BOX}) && 
$ENV{management_node_info}{SHARED_EMAIL_BOX}){
+               my $shared_mail_box = 
$ENV{management_node_info}{SHARED_EMAIL_BOX};
+       }
+
        # Get the current time
        my $currenttime = makedatestring();
        
@@ -706,14 +707,14 @@ END
                $log_message .= "\n";
 
                my $from    = "ro...@$fqdn";
-               my $to      = $SYSADMIN;
+               my $to      = $sysadmin;
                my $subject = "PROBLEM -- $filename";
                mail($to, $subject, $body, $from);
        } ## end elsif ($error == 2)  [ if ($error == 1)
 
        # MAILMASTERS - only for email notifications
-       elsif ($error == 5 && $SHARED_MAILBOX) {
-               my $to      = $SHARED_MAILBOX;
+       elsif ($error == 5 && $shared_mail_box) {
+               my $to      = $shared_mail_box;
                my $from    = "ro...@$fqdn";
                my $subject = "Informational -- $filename";
 
@@ -1221,9 +1222,14 @@ sub mail {
        }
        my $localreturnpath = "-f $RETURNPATH";
        my $mailer = Mail::Mailer->new("sendmail", $localreturnpath);
+       
+       my $shared_mail_box = 0;
+       if(defined($ENV{management_node_info}{SHARED_EMAIL_BOX}) && 
$ENV{management_node_info}{SHARED_EMAIL_BOX}){
+               my $shared_mail_box = 
$ENV{management_node_info}{SHARED_EMAIL_BOX};
+       }
 
-       if ($SHARED_MAILBOX) {
-               my $bcc = $SHARED_MAILBOX;
+       if ($shared_mail_box) {
+               my $bcc = $shared_mail_box;
                if ($mailer->open({From    => $from,
                                                                 To      => $to,
                                                                 Bcc     => 
$bcc,
@@ -1236,7 +1242,7 @@ sub mail {
                else {
                        notify($ERRORS{'WARNING'}, 0, "NOTICE --  Problem 
sending mail to: $to From");
                }
-       } ## end if ($SHARED_MAILBOX)
+       } ## end if ($shared_mail_box)
        else {
                if ($mailer->open({From    => $from,
                                                                 To      => $to,
@@ -1249,7 +1255,7 @@ sub mail {
                else {
                        notify($ERRORS{'WARNING'}, 0, "NOTICE --  Problem 
sending mail to: $to From");
                }
-       } ## end else [ if ($SHARED_MAILBOX)
+       } ## end else [ if ($shared_mail_box)
 } ## end sub mail
 
 #/////////////////////////////////////////////////////////////////////////////
@@ -6076,7 +6082,10 @@ AND managementnode.id != $management_nod
        $management_node_info->{PUBLIC_SUBNET_MASK} = 
$management_node_info->{publicSubnetMmask};
        $management_node_info->{PUBLIC_DEFAULT_GATEWAY} = 
$management_node_info->{publicDefaultGateway};
        $management_node_info->{PUBLIC_DNS_SERVER} = 
$management_node_info->{publicDNSserver};
-
+       
+       # Add sysadmin and sharedMailBox email address values
+       $management_node_info->{SYSADMIN_EMAIL} = 
$management_node_info->{sysadminEmailAddress};
+       $management_node_info->{SHARED_EMAIL_BOX} = 
$management_node_info->{sharedMailBox};
        
        # Set the management_node_info environment variable if the info was 
retrieved for this computer
        $ENV{management_node_info} = $management_node_info if 
($management_node_identifier eq $hostname);

Modified: incubator/vcl/trunk/mysql/vcl.sql
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/mysql/vcl.sql?rev=983008&r1=983007&r2=983008&view=diff
==============================================================================
--- incubator/vcl/trunk/mysql/vcl.sql (original)
+++ incubator/vcl/trunk/mysql/vcl.sql Fri Aug  6 15:00:14 2010
@@ -500,6 +500,8 @@ CREATE TABLE IF NOT EXISTS `managementno
   `publicSubnetMask` varchar(56) default NULL,
   `publicDefaultGateway` varchar(56) default NULL,
   `publicDNSserver` varchar(56) default NULL,
+  `sysadminEmailAddress` varchar(128) default NULL,
+  `sharedMailBox` varchar(128) default NULL,
   PRIMARY KEY  (`id`),
   KEY `stateid` (`stateid`),
   KEY `ownerid` (`ownerid`),


Reply via email to