Modify

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#258 closed defect (fixed)

Commenting on existing tickets

Reported by: jacob@… Owned by: Bas van der Vlies
Priority: normal Component: EmailtoTracScript
Severity: normal Keywords:
Cc: jacob@…, mjhweb-trac-tickets@… Trac Release: 0.10

Description

It would be nice if it was possible to comment on existing tickets and not only create new tickets via email. I'm not sure what the format should be, perhaps the subject could be something like "#14" and the body then be the comment.

Attachments (0)

Change History (34)

comment:1 Changed 18 years ago by Bas van der Vlies

Cc: jacob@… added; anonymous removed
Status: newassigned

I am also thinking about a solution for replies to tickets. If somebody replies to the ticket is will automatically update the ticket with the info. To update the ticket is not so hard but to find the right tickets is.

To put the ticket number in the subject is a good one.

comment:2 Changed 18 years ago by garyo@…

Trac Release: 0.8

I'd also like this. We are migrating from RT bug tracker to using trac for everything, and this is one missing feature. Every time I email a user regarding a ticket I have to cut & paste the reply into the trac ticket. And attachments are even harder; I have to save them on my disk then go into trac and attach them to the ticket.

RT uses a customizable regex in the subject, which is normally something like

[PROJECTNAME#NN]

I suggest using the same format, and having a trac.ini setting to set PROJECTNAME.

comment:3 Changed 18 years ago by anonymous

I will use the format as you suggested. Thanks. If i find the time i will implement it ;-)

comment:4 Changed 18 years ago by anonymous

Why not use the format trac uses in it's subject line ("[PROJECTNAME] #NNN"), that way it could be set up to handle responses via email.

comment:5 Changed 18 years ago by anonymous

Cc: mjhweb-trac-tickets@… added

comment:6 Changed 18 years ago by anonymous

First working version is in trunk, I will make it an option to enable/disable it. I am still in the testing fase. But everythin seems to be working.

Are you able to test it?

comment:7 Changed 18 years ago by anonymous

I have made options for "ticket_update:1". So is still the question can somebody else test is?

comment:8 Changed 18 years ago by anonymous

I installed the version on yesterday's trunk with this update included.

All features I tried worked (including attachments, CC's, --component, etc), but not the updating existing tickets. I see the error below. For some reason I have had to enter email2trac in the NIS+ aliases, as run_email2trac just gives me error 254 (UID invalid).

The problem I get with updating an existing ticket is this "component" complaint irrespective of whether I have --component=<component> in the alias or not.

Creating with the nice [NAME] #nyz is good, but the reply breaks.

So I tested, but doesn't seem to work right here?

Sample:

[DEFAULT]
project: /priv/disk/trac/sampleproj
debug: 2
umask: 022
spam_level: 4
reply_address: 1
reply_all : 1
mailto_link: 0
mailto_cc: tracproj@mydomain.com.au
ticket_update: 1
email_comment: >
email_header: 1
trac_version: 0.9
alternate_notify_template :
   ----- The following addresses had permanent fatal errors -----
"|/usr/local/bin/email2trac"
    (reason: 1)
    (expanded from: <tracproj@mydomain.com.au>)

   ----- Transcript of session follows -----
TD: saving email to /var/tmp/msg.txt
TD: part1: Content-Type: text/plain
TD: part1: filename: None
TD: this part is not multipart
TD: writing part1 (/var/tmp/part1)
Traceback (most recent call last):
  File "/usr/local/bin/email2trac", line 759, in ?
    tktparser.parse(sys.stdin)
  File "/usr/local/bin/email2trac", line 464, in parse
    if self.ticket_update(m):
  File "/usr/local/bin/email2trac", line 338, in ticket_update
    tkt = Ticket(self.db, ticket_id)
  File "/opt/local/lib/python2.3/site-packages/trac/ticket/model.py", line 35, in __init__
    self.fields = TicketSystem(self.env).get_ticket_fields()
  File "/opt/local/lib/python2.3/site-packages/trac/core.py", line 147, in __new__
    if not cls in compmgr.components:
  File "/opt/local/lib/python2.3/site-packages/trac/db.py", line 102, in __getattr__
    return getattr(self.cnx, name)
  File "/opt/local/lib/python2.3/site-packages/trac/db.py", line 102, in __getattr__
    return getattr(self.cnx, name)
AttributeError: 'pysqlite2.dbapi2.Connection' object has no attribute 'components'
554 5.3.0 unknown mailer error 1



Reporting-MTA: dns; mydomain.com.au
Received-From-MTA: DNS; mydesktop
Arrival-Date: Tue, 30 May 2006 13:38:59 +1000 (EST)

Final-Recipient: RFC822; tracproj@mydomain.com.au
X-Actual-Recipient: X-Unix; |/usr/local/bin/email2trac
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Unix; 1
Last-Attempt-Date: Tue, 30 May 2006 13:39:03 +1000 (EST)

comment:9 Changed 18 years ago by anonymous

Which MTA do you use? Sendmail, Postfix or something else

If have checked the source for 0.9 and higher. The ticket API has changed. I have updated the ticket_update function for this new API. So the error you reported is fixed.

comment:10 Changed 18 years ago by anonymous

MTA is sendmail. Sorry about that. Thanks I'll try the fix.

comment:11 Changed 18 years ago by anonymous

Good improvement, the email is being converted and populating the Trac backend and the email to the reporter is send.

But something else appears broken. Does this help?

Details attached.

----- The following addresses had permanent fatal errors -----

"|/usr/local/bin/email2trac"

(reason: 1) (expanded from: <tracproj@…>)

----- Transcript of session follows -----

TD: saving email to /var/tmp/msg.txt TD: part1: Content-Type: text/plain TD: part1: filename: None TD: this part is not multipart TD: writing part1 (/var/tmp/part1) Traceback (most recent call last):

File "/usr/local/bin/email2trac", line 761, in ?

tktparser.parse(sys.stdin)

File "/usr/local/bin/email2trac", line 466, in parse

if self.ticket_update(m):

File "/usr/local/bin/email2trac", line 358, in ticket_update

self.notify(tkt, False, when)

File "/usr/local/bin/email2trac", line 526, in notify

print 'TD: Failure sending notification on creation of ticket #%s: %s' \

File "/opt/local/lib/python2.3/site-packages/trac/ticket/model.py", line 97, in getitem

return self.values[name]

KeyError: 'id' 554 5.3.0 unknown mailer error 1

Reporting-MTA: dns; mydomain.com.au Received-From-MTA: DNS; mydesktop Arrival-Date: Tue, 30 May 2006 17:05:32 +1000 (EST)

Final-Recipient: RFC 822; tracproj@… X-Actual-Recipient: X-Unix; |/usr/local/bin/email2trac Action: failed Status: 5.0.0 Diagnostic-Code: X-Unix; 1 Last-Attempt-Date: Tue, 30 May 2006 17:05:47 +1000 (EST)

comment:12 Changed 18 years ago by anonymous

This must also be API change i think or something else i hav eto look at the source for trac 0.9.X or do use another version?

comment:13 Changed 18 years ago by anonymous

Another question is does notifcations work for new tickets. If this is true then there is something wrong with geting the right ticket number. The notify() function complains that there is no 'id' field. The strange thing is that you say that the ticket is updated. This can only be succesful if there is an "id" field ;(

comment:14 Changed 18 years ago by anonymous

Trac 0.9.5 is currently in production. PySqlite 2.2.2 with Sqlite 3.3.5

With regard to the test you suggest the result follows:

  • Emailing in a new ticket sent to the project alias tracproj works without a problem. The message is sent, placed into the Trac backend and the trac.ini notification to reporter is sent.
  • Updating this ticket with a reply sent to tracproj updates the ticket in the trac backend, generates the notification to the reporter and a second email is sent with the key issue being as in the message listed above, but quoted here:
  File "/usr/local/bin/email2trac", line 526, in notify
    print 'TD: Failure sending notification on creation of ticket #%s: %s' \
  File "/opt/local/lib/python2.3/site-packages/trac/ticket/model.py", line 97, in __getitem__
    return self.values[name]
KeyError: 'id'
554 5.3.0 unknown mailer error 1

comment:15 Changed 18 years ago by Bas van der Vlies

Can you change the line:

print 'TD: Failure sending notification on creation of ticket #%s: %s' %(tktid?, e)

to:

print tkt, e

Thanks

comment:16 Changed 18 years ago by anonymous

This appears to have fixed the problem. Both creation and update of the ticket was successful and no additional email is now sent.

Great! Thanks.

comment:17 Changed 18 years ago by Bas van der Vlies

This can not fix the error. There is an error/exeception and i want to know which error it is. If you have notification set in trac.ini then email must sent if there is an update of a ticket.

Did you set notification in trac.ini

So what did you changed? can you post the notify() function

Thanks

comment:18 Changed 18 years ago by anonymous

Nothing was changed here other than what I was requested to change above... Somehow it fixed the error and I cannot explain this...

Is it possible that the characters being sent in the previous error statement were causing Sendmail to detect a fault or the \ to escape the line has a control character that was causing the problem? Just to make sure I reinstated the old code it broke again. But when I put the line you suggest back in the problem goes away. In VIM I notice that there is an extra TAB before the text for the continued line after the previous line was escaped so it is indented further.

The notification part of the trac.ini is:

[notification]
smtp_enabled = true
smtp_replyto = tracproj@mydomain.com.au
smtp_always_cc = 
smtp_server = mydomain.com.au 
smtp_from = tracproj@mydomain.com.au
always_notify_reporter = true
smtp_defaultdomain = mydomain.com.au

The notify() routine is:

        def notify(self, tkt , new=True, modtime=0):
                try:
                        # create false {abs_}href properties, to trick Notify()
                        #
                        self.env.abs_href = Href(self.get_config('project', 'url'))
                        self.env.href = Href(self.get_config('project', 'url'))

                        tn = TicketNotifyEmail(self.env)
                        if self.notify_template:
                                tn.template_name = self.notify_template;

                        tn.notify(tkt, new, modtime)

                except Exception, e:
                        print tkt, e
                        #print 'TD: Failure sending notification on creation of ticket #%s: %s' \
                        #               % (tkt['id'], e)

comment:19 Changed 18 years ago by Bas van der Vlies

Resolution: fixed
Status: assignedclosed

Oke thanks, It must be the '\' in the line. I will fix it and thanks for reporting. I will close the ticket. At our site everything seems the work ;-)

comment:20 Changed 18 years ago by greg.deakyne@…

Resolution: fixed
Status: closedreopened

I've made the changes described above and I still can't reply to the generated emails to followup on a specific ticket without getting the error like the user above "KeyError: 'id'". I can however reply via outlook client and it works all around. But from OWA and from my gmail web account, it adds a comment to the ticket with the email text, but the trac server bounces back an email with error status 1. I'm on 0.10 and using 0.7 of email2trac.

comment:21 Changed 18 years ago by anonymous

Can you look in the mail logs what the error is?

I have just fixed an error in our enviroment when we add attachmennts that where already known.

It is the latest trunk version. Can you try it?

comment:22 Changed 18 years ago by greg.deakyne@…

Trac Release: 0.80.10

I just updated to trunk. Still the same problem from web based email. Here is the bounce back w/ mail error. I'm using sendmail. If switching to postfix fixes the problem, I will give that a try.

   ----- The following addresses had permanent fatal errors -----
|email2trac
   (reason: 1)
   (expanded from: <tracproj@luigi.etapestry.com>)

  ----- Transcript of session follows -----
Traceback (most recent call last):
 File "/etc/smrsh/email2trac", line 765, in ?
   tktparser.parse(sys.stdin)
 File "/etc/smrsh/email2trac", line 467, in parse
   if self.ticket_update(m):
 File "/etc/smrsh/email2trac", line 356, in ticket_update
   self.attachments(m, tkt)
 File "/etc/smrsh/email2trac", line 641, in attachments
   att = attachment.Attachment(self.env, 'ticket', ticket['id'])
 File "/usr/lib/python2.4/site-packages/trac/ticket/model.py", line 106, in __getitem__
   return self.values[name]
KeyError: 'id'
554 5.3.0 unknown mailer error 1


Final-Recipient: RFC822; tracproj@luigi.etapestry.com
X-Actual-Recipient: X-Unix; |email2trac
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Unix; 1
Last-Attempt-Date: Fri, 16 Jun 2006 10:22:27 -0400

comment:23 Changed 18 years ago by anonymous

I have to examine what is changed in 0.10. I have no heard about this error in teh 0.8 and 0.9 versions. I do not think the bug is related by the MTA (sendmail or postfix).

A question can you send emails with attachements to your ticket email-address. Not a reply but directly and what is the subject line?

comment:24 Changed 18 years ago by Bas van der Vlies

Can you add these debug statements to ticket_update function:

--- /usr/local/bin/email2trac   2006-06-20 10:44:02.914317254 +0200
+++ email2trac.py       2006-06-20 10:36:09.947065261 +0200
@@ -353,6 +353,10 @@
                        tkt = Ticket(self.env, ticket_id, self.db)
                        tkt.save_changes(self.author, body_text, when)

+               fd = open('/tmp/ticket_update.function', 'a+')
+               fd.write(str(tkt))
+               fd.close()
+
                self.attachments(m, tkt)

I send me the saved output thanks

comment:25 in reply to:  23 Changed 18 years ago by greg.deakyne@…

Emailing via OWA with an attachment works. It opens a new ticket with 2 attachments: 1 for the html message and 1 for the attached picture.

Replying to anonymous:

I have to examine what is changed in 0.10. I have no heard about this error in teh 0.8 and 0.9 versions. I do not think the bug is related by the MTA (sendmail or postfix).

A question can you send emails with attachements to your ticket email-address. Not a reply but directly and what is the subject line?

comment:26 in reply to:  24 Changed 18 years ago by anonymous

I added the 3 lines. Where and what should I be seeing?

Replying to bas:

Can you add these debug statements to ticket_update function:

--- /usr/local/bin/email2trac   2006-06-20 10:44:02.914317254 +0200
+++ email2trac.py       2006-06-20 10:36:09.947065261 +0200
@@ -353,6 +353,10 @@
                        tkt = Ticket(self.env, ticket_id, self.db)
                        tkt.save_changes(self.author, body_text, when)

+               fd = open('/tmp/ticket_update.function', 'a+')
+               fd.write(str(tkt))
+               fd.close()
+
                self.attachments(m, tkt)

I send me the saved output thanks

comment:27 in reply to:  24 Changed 18 years ago by greg.deakyne@…

Here is what you arae probably looking for: [root@luigi tmp]# cat ticket_update.function <trac.ticket.model.Ticket object at 0xb7b9deac>

Replying to bas:

Can you add these debug statements to ticket_update function:

--- /usr/local/bin/email2trac   2006-06-20 10:44:02.914317254 +0200
+++ email2trac.py       2006-06-20 10:36:09.947065261 +0200
@@ -353,6 +353,10 @@
                        tkt = Ticket(self.env, ticket_id, self.db)
                        tkt.save_changes(self.author, body_text, when)

+               fd = open('/tmp/ticket_update.function', 'a+')
+               fd.write(str(tkt))
+               fd.close()
+
                self.attachments(m, tkt)

I send me the saved output thanks

comment:28 Changed 18 years ago by anonymous

Not exactly i expect to see all the ticket fields with values and not a object.

comment:29 Changed 18 years ago by greg.deakyne@…

Is it having a hard time with the subject line and it can't parse the ticket number out?

comment:30 Changed 18 years ago by anonymous

You say it will update the ticket but it fails with adding attachments. So it has the good ticket number. can change the debug statement to:

+               fd = open('/tmp/ticket_update.function', 'a+')
+               fd.write(tkt['description'] + '\n')
+               fd.close()

comment:31 Changed 18 years ago by greg.deakyne@…

Here is the debug output

'''To:''' help.trac@etapestry.com [[BR]]
This message has 1 attachment(s)

{{{
it's a bugger

}}}

Also, this is what is in the bounceback message:

  ----- Transcript of session follows -----
Traceback (most recent call last):
 File "/etc/smrsh/email2trac", line 770, in ?
   tktparser.parse(sys.stdin)
 File "/etc/smrsh/email2trac", line 472, in parse
   if self.ticket_update(m):
 File "/etc/smrsh/email2trac", line 361, in ticket_update
   self.attachments(m, tkt)
 File "/etc/smrsh/email2trac", line 646, in attachments
   att = attachment.Attachment(self.env, 'ticket', ticket['id'])
 File "/usr/lib/python2.4/site-packages/trac/ticket/model.py", line 106, in __getitem__
   return self.values[name]
KeyError: 'id'
554 5.3.0 unknown mailer error 1


Final-Recipient: RFC822; tracproj@luigi.etapestry.com
X-Actual-Recipient: X-Unix; |email2trac
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Unix; 1
Last-Attempt-Date: Tue, 20 Jun 2006 17:27:02 -0400

}}}

comment:32 Changed 18 years ago by anonymous

We have found the bug the behaviour of fetching tickets has been changed see #449. The id field is not set. we changed it and tomorrow there is a patch. Maybe a bug in trac.

I have a question can you update the wiki pages for sendmail setup?

Thanks

comment:33 Changed 18 years ago by anonymous

Type: enhancementdefect

Applied the patch from ticket #449 to trac versions greater then 0.8. Hopefully it will close ths bug

comment:34 Changed 18 years ago by greg.deakyne@…

Resolution: fixed
Status: reopenedclosed
  • Applied the patch from #449 and it worked. Thanks for your help!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Bas van der Vlies.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.