Opened 5 years ago

Last modified 3 years ago

#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)


#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)

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

Change History (4)

comment:1 Changed 5 years ago by fhd

  • Description modified (diff)

comment:2 Changed 5 years ago by trev

  • Description modified (diff)

comment:3 Changed 5 years ago by trev

  • Description modified (diff)

comment:4 Changed 3 years ago by fhd

  • Cc trev removed
Note: See TracTickets for help on using tickets.