[rt-users] How do I override a default scrip?

Bill Cole rtusers-20090205 at billmail.scconsult.com
Sat May 19 01:19:28 EDT 2012


On 19 May 2012, at 0:15, Paul Tomblin wrote:

> On Fri, May 18, 2012 at 11:51 PM, Bill Cole
> <rtusers-20090205 at billmail.scconsult.com> wrote:
>> On 18 May 2012, at 17:40, Paul Tomblin wrote:
>>
>>> On Fri, May 18, 2012 at 3:47 PM, Bill Cole
>>> <rtusers-20090205 at billmail.scconsult.com> wrote:
>>>>
>>>> Another option is to modify the Global Scrip with a User Defined
>>>> Condition
>>>> that returns 0 if the Queue is one that you want to exempt.
>>>
>>>
>>> How do I programmatically add one of these User Defined Conditions 
>>> to
>>> an existing RT Global Scrip?  (Preferably something that I can do 
>>> in
>>> my etc/initialdata)
>>
>>
>> Ewww. Why???
>
> Because I want to provide an extension that my client can install on
> their RT installation, and when they type "make initdb" in the source
> directory for my extension it adds all the things that are particular
> to that extension to the RT system.  Just like the way literally
> dozens of other extensions that I've looked at do it.

OIC.

Incidentally, this is the first mention of "extension" in this thread. 
Writing an RT extension may be something that has been done dozens of 
times, but it's hard to guess that anyone in particular is doing it and 
asking questions about it on this list. You might get better guesses out 
of the rt-devel list. I'm not there.

[...]
>> With that caveat, I think it's not true that the way Scrips relate to 
>> Queues
>> is inconsistent with Templates. Templates also are either 
>> Queue-specific or
>> Global and point to their Queue by ID, rather than the Queue pointing 
>> to
>> them by name. This is pretty much orthodox data structuring.
>
> That is simply not true.  If I want to override the system provided
> "Resolved" template for a particular queue, then all I have to do is
> make a new template called "Resolved" on that queue.  It's referenced
> by name, and only my new Resolved template will be used for that
> queue.

That's an interesting fact that I'd somehow missed in 12 years of 
working with RT...

A Scrip references its Template by ID. Really. I'm looking at that in 
the database. It's also documented that way in the API docs, but looking 
further down I see hints of nefarious magic at RT::Template->Load() I 
also just tested and confirmed what you say: even if I specifically pick 
the Global:$Name Template in a Scrip, the $QueueName:$Name Template gets 
used. Spooky.

> If I want to override the behavior of the default "On Resolve
> Notify Requestors" for a particular queue I can't just create a new
> Scrip with the same name, because then it will run both Scrips.  There
> is no definition of the word "consistent" which that fits the
> definition of.

But Scrips cannot be that way: there is no RT::Scrip=>Name. There's a 
Description, but that would be analogous to a Template's Description. 
Since Scrips don't *HAVE* a Name, they can't override by Name, yes?

But I do concede that there's inconsistency. Thus is the world. 
Different things are different.



More information about the rt-users mailing list