[rt-users] sanity check on a scrip/custom flow

Kimberly McKinnis kmckinnis at tivo.com
Wed Sep 9 17:50:02 EDT 2009


So a little background... this used to work. Then I rebuilt the system, and all I can think is that I missed a step somewhere.

I have a queue called te-accounts. Vendors/partners email it to get an automated account set up. It's supposed to look at the domain they're emailing from, and add the user to the appropriate group. Then it is supposed to resolve the ticket, and reply to the requestor with a custom template.

What's actually happening is that it opens a ticket, immediately resolves the ticket, and responds with the generic resolved template. The user is never added to any groups.

I could use a sanity check on the moving parts to make sure I didn't miss something silly.

Queue "accounts" allows "Everyone" and "Unpriviledged" to "CreateTicket".


/etc/aliases (emails me the original request also, so I can manually intervene when it breaks)
te-accounts: accounts-queue, accounts-email
accounts-queue: "|/usr/bin/rt-mailgate --queue accounts --action correspond --url https://spdsupport.tivo.com/ --timeout 1000"
accounts-email: kmckinnis at tivo.com<mailto:kmckinnis at tivo.com>

accounts queue scrips:
Description: Adding new users to group based on domain
Condition: On Create
Action: User Defined
Template: Global Template: Autoreply
Stage: TransactionCreate

Custom condition <blank>
Custom action preparation code: return 1;
Custom action cleanup code:
# Domains we want to move
my $domains = {};

my %domain_map = (
                   '\@.*\.?comcast\.com'         => "comcast",
                   '\@.*\.?cox\.com'        => "cox",
                   '\@.*\.?tvworks\.com'        => "comcast",
                 '\@.*\.?tivo\.com'      => "support"
                );

#Check each of our defined domains for a match
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
    # Domain matches - move to the right group

my $user = RT::User->new( $RT::SystemUser );
$user->LoadByEmail($self->TicketObj->RequestorAddresses);
die "couldn't load user" unless $user->id;
my $group = RT::Group->new( $RT::SystemUser );
    $group->LoadUserDefinedGroup( $domain_map{$domainKey} );
    $group->AddMember($user->id);
    }
}

Description: Resolve all tickets in this queue
Condition: On create
Action: User Defined
Template: Global template: group addition
Stage: TransactionCreate
Custom condition: <blank>
Custom action preparation code: return 1;
Custom action cleanup code:
$self->TicketObj->SetStatus('resolved');
return 1;


Global template for resolve account only tickets:
Subject: Resolved: {$Ticket->Subject}

Your account has been given permissions to the $group queue. Please log in via the web interface at ".$RT::WebURL." to view tickets for the $group queue.

                        Thank you.
                        {$Ticket->QueueObj->CorrespondAddress()}

-------------------------------------------------------------------------
{$Transaction->Content()}



So what the heck am I missing?

~~
Kimberly McKinnis
System Operations Engineer
Service Provider Division, TiVo Inc
408-519-9607









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090909/2fc83f94/attachment.htm>


More information about the rt-users mailing list