How do I override a default scrip?

How can I override a default scrip for a queue? If I define a new
scrip with the same name as an existing one, it runs both of them.

http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin

How can I override a default scrip for a queue?

You don’t. A Scrip is either Global or limited to a single Queue, and is
either enabled or disabled in that scope. If you have a Scrip that you
want to apply to all Queues except for one, you need to disable the
Global version and replicate it in all Queues except for one.

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.

If I define a new
scrip with the same name as an existing one, it runs both of them.

Yes, it does. Scrips are objects that point to Queues by ID, Queues are
not objects that point to Scrips by name.

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)

If I define a new
scrip with the same name as an existing one, it runs both of them.

Yes, it does. Scrips are objects that point to Queues by ID, Queues are not
objects that point to Scrips by name.

I’d just like to point out that’s completely inconsistent with the way
Templates are done.

http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin

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)

Oh wait, I could do that with an overlay, couldn’t I?

http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin

Paul,

Scrips and templates have different functions, so of course they do not
have the same consistent behavior.

KennOn Fri, May 18, 2012 at 3:40 PM, Paul Tomblin ptomblin@xcski.com wrote:

On Fri, May 18, 2012 at 5:40 PM, Paul Tomblin ptomblin@xcski.com wrote:

rtusers-20090205@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)

Oh wait, I could do that with an overlay, couldn’t I?


http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin

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???

With a running RT (i.e. a system where etc/initialdata has seen its
single lifetime access) just go into the Scrip’s definition
(Configuration->Global->Scrips->$WhicheverOneYouAreChanging) and switch
the “Condition” from whatever it is (e.g. “On Comment”) to “User
Defined” and put some suitable perl in the “Custom condition” text area.
See http://requesttracker.wikia.com/wiki/WriteCustomCondition for clues
on suitable perl. See
http://requesttracker.wikia.com/wiki/Documentation#Scrips for more links
to doc on Scrips.

I suppose you could do the needful to put your custom scrip into
etc/initialdata, but I can’t see a way to make that a rational thing to
do. It’s name has meaning…

If I define a new
scrip with the same name as an existing one, it runs both of them.

Yes, it does. Scrips are objects that point to Queues by ID, Queues
are not
objects that point to Scrips by name.

I’d just like to point out that’s completely inconsistent with the way
Templates are done.

You may want to have “inconsistency” discussions with Jesse Vincent. I
gave up trying to understand the reasoning behind RT internal
architecture a couple of major versions ago. It wasn’t a hobby that was
making me happy… Now I just try to keep the useful facts in my head
without judging what I really don’t understand.

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.

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)

Oh wait, I could do that with an overlay, couldn’t I?

Um, maybe YOU could, but I sure wouldn’t try it that way…

Scrips are configuration data, not program code. This sort of Condition
is going to reference specific Queues in your instance, so you really
want it in the database where you can easily tweak it and where there’s
no way for it to conflict with the next minor version of RT.

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.

With a running RT (i.e. a system where etc/initialdata has seen its single
lifetime access) just go into the Scrip’s definition
(Configuration->Global->Scrips->$WhicheverOneYouAreChanging) and switch the
“Condition” from whatever it is (e.g. “On Comment”) to “User Defined” and
put some suitable perl in the “Custom condition” text area. See

I don’t want to have to log into their RT systems and configure them
for them. I want them to be able to install it on as many or as few
RT systems as they want just by typing “make; make initdb; make
install” just like every other RT extension.

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. 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.

http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin

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.