Bug 493198

Summary: [AUDIT] extensions/issuetracker/lib/IssueTracker.pm is not using standard Bugzilla mailer code
Product: [Community] Bugzilla Reporter: David Lawrence <dkl>
Component: Creating/Changing BugsAssignee: David Lawrence <dkl>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 3.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-08 16:44:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 493184    
Attachments:
Description Flags
Patch to convert IssueTracker.pm to use Bugzilla/Mailer.pm (v1)
nelhawar: review+
Patch to convert IssueTracker.pm to use Bugzilla/Mailer.pm (v2) nelhawar: review+

Description David Lawrence 2009-03-31 21:45:33 UTC
mailError:

Why note use the same mail code as the rest of BZ why make your own as mailError? extensions/issuetracker/lib/IssueTracker.pm:

sub mailError {
    my ( $it_id, $error, $extra ) = @_;

    my $host = eval { require Sys::Hostname; Sys::Hostname::hostname() }
        || 'undefined';
    my $stack = eval { require Carp; Carp::longmess("stack backtrace") }
        || 'undefined';
    my $user
        = eval { require Bugzilla; Bugzilla->user->identity } || 'undefined';

    warn "Error communicating with IssueTracker ID(s): $it_id: $error";

    # Send email to bugzilla owner about the problem
    my $err_msg = "To: " . Bugzilla->params->{maintainer} . "\n";
    $err_msg .= "From: bugzilla\@redhat.com\n";
    $err_msg
        .= "Subject: Error communicating with IssueTracker ID(s): $it_id\n\n";
    $err_msg .= "Error communicating with IssueTracker ID(s): $it_id\n";
    $err_msg .= "Error \$\@: $error\n\n";
    $err_msg .= "Host: $host\n";
    $err_msg .= "Pid:  $$\n";
    $err_msg .= "User: $user\n";
    $err_msg .= "Remote Address: $ENV{REMOTE_ADDR}\n";
    $err_msg .= "Stack Trace:\n$stack\n";
    $err_msg .= "Extra Data:\n$extra\n" if $extra;

    open( SENDMAIL, "|/usr/lib/sendmail -t -i" )
        || warn "Can't open sendmail";
    print SENDMAIL $err_msg;
    close SENDMAIL || warn "Can't close sendmail";
}



Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 David Lawrence 2009-04-06 20:37:08 UTC
Created attachment 338392 [details]
Patch to convert IssueTracker.pm to use Bugzilla/Mailer.pm (v1)

Comment 2 Noura El hawary 2009-04-07 12:11:09 UTC
Comment on attachment 338392 [details]
Patch to convert IssueTracker.pm to use Bugzilla/Mailer.pm (v1)

Hi Dave,

I tested the patch and it seems to be working fine as far as sending mail using MessageToMTA is the concern, but i am getting an error of undefined subroutine Bugzilla::CGI::remote_address from the code below

>+    $err_msg .= "Remote Address: " . Bugzilla->cgi->remote_address() . "\n";


so is the patch missing that subroutine? or am i missing some info?

Thanks,
Noura

Comment 3 Noura El hawary 2009-04-07 12:19:38 UTC
Comment on attachment 338392 [details]
Patch to convert IssueTracker.pm to use Bugzilla/Mailer.pm (v1)

Hey Dave,

I saw this patch before the other patch the creates the remote_address subroutine for this patch, Please ignore my previous comment.

Thanks,
Noura

Comment 4 David Lawrence 2009-04-07 20:54:55 UTC
Created attachment 338607 [details]
Patch to convert IssueTracker.pm to use Bugzilla/Mailer.pm (v2)

Oops. That extra change was part of the other patch I submitted for Bugzilla::CGI::remote_address() so I removed that for now. The other patch will fix this file when I commit it later.

New simplified patch for review.

Dave

Comment 5 Noura El hawary 2009-04-08 11:55:52 UTC
Comment on attachment 338607 [details]
Patch to convert IssueTracker.pm to use Bugzilla/Mailer.pm (v2)

Patch Looks good Dave.

Thanks,
Noura

Comment 6 David Lawrence 2009-04-08 16:44:10 UTC
Committed.

Dave