Opened on 02/22/2016 at 04:37:12 PM

Last modified on 12/21/2017 at 11:29:03 AM

#3678 new change

Replace the XmlRpcPlugin

Reported by: fhd Assignee:
Priority: P3 Milestone:
Module: Infrastructure Keywords:
Cc: Blocked By: #3676
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by trev)

Background

#3676 adds two Trac plugins:

  1. The XmlRpc plugin.
  2. The HttpAuth plugin, which allows the API user to authenticate via HTTP basic auth, interfacing with the AccountManager plugin we also use.

It would be better for security and sanity to not rely on these plugins.

What to change

Since we only need the Trac API for communicating between servers controlled by us, we could simply invoke a Python script via SSH that interacts with the Trac environment in the same way plugins do.

Since we don't want the change the issue status, it should be possible to minify the update code in XML-RPC plugin as follows:

from trac.env import Environment
from trac.util.datefmt import to_datetime, utc
import trac.ticket.model as model
from trac.ticket.notification import TicketNotifyEmail

env = Environment(env_path)
when = to_datetime(None, utc)
ticket = model.Ticket(env, ticket_id)
ticket.save_changes(author, comment, when=when)

try:
  tn = TicketNotifyEmail(env)
  tn.notify(ticket, newticket=False, modtime=when)
except Exception, e:
  warn("Failure sending notification on change of "
       "ticket #%s: %s" % (ticket.id, e))

Attachments (0)

Change History (4)

comment:1 Changed on 02/23/2016 at 11:49:16 AM by fhd

  • Description modified (diff)

comment:2 Changed on 02/23/2016 at 11:52:22 AM by trev

  • Description modified (diff)

comment:3 Changed on 02/23/2016 at 12:04:08 PM by trev

  • Description modified (diff)

comment:4 Changed on 12/21/2017 at 11:29:03 AM by fhd

  • Cc trev removed

Add Comment

Modify Ticket

Change Properties
Action
as new .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from (none).
Next status will be 'reviewing'.
 
Note: See TracTickets for help on using tickets.