16 November 2009

getting supybot to announce new bugzilla bugs

getting supybot to announce new bugzilla bugs - I've just put here the key non-obvious things that tripped me up when trying to set this up.

All done on Ubuntu 8.04.3 LTS

Install supybot and the supybot bugzilla plugin.

Create a system group (supybot) and user (bugbot) to run supybot as.

Set up your supybot configuration file as desired.

Getting supybot to start at startup:

Here's my modified init script

$ cat /etc/init.d/bugbot
#! /bin/sh
# supybot init script
# http://www.schwer.us/journal/2005/04/17/supybot-init-script-for-debian/


test -f $DAEMON || exit 0

set -e

case "$1" in
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet \
--chuid bugbot --exec $DAEMON -- --daemon /etc/supybot/bugbot.conf
echo "$NAME."
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet \
--oknodo --exec /usr/bin/python
echo "$NAME."
$0 stop
$0 start
echo "Usage: $0 {start|stop|restart}" >&2
exit 1

exit 0

Set up bugzilla to send a copy of all bugmail to a local address (eg bugbot@localhost), and configure exim4 to accept local mail (as well as smart host delivery), using the mbox format.

sudo dpkg-reconfigure exim4-config

Start a conversation with bugbot, get it to identify you, then set the required configuration by sending it messages (you can also set these in the supybot .conf file for your bot):
  • config plugins.Bugzilla.mbox /var/mail/bugbot

  • config plugins.Bugzilla.bugzillas.your-bugzilla-name.watchedItems.all True
    which will turn on the announcements (i had to read the code to find that one!)

Note that supybot doesn't immediately write config changes to disc.

08 November 2009

bugzilla upgrades and user tokens

It's bugzilla upgrade time for my private install, and I have for the second time run into a strange issue with the tokens system. Since this is the second time and I know how to fix it, here it is for the record.

I have upgrade from v3.0.4 to 3.4.3.

Once the site was up again, saving the site parameters (editparams.cgi) showed a big red warning:

It looks like you didn't come from the right page (you have no valid token for the edit_parameters action while processing the 'editparams.cgi' script). The reason could be one of:
  • You clicked the "Back" button of your web browser after having successfully submitted changes, which is generally not a good idea (but harmless).
  • You entered the URL in the address bar of your web browser directly, which should be safe.
  • You clicked on a URL which redirected you here without your consent, in which case this action is much more critical.
Are you sure you want to commit these changes anyway? This may result in unexpected and undesired results.

[Confirm Changes]

Or throw away these changes and go back to editparams.cgi.

Pushing the button doesn't work (same page shows again).

After much digging last time I discovered that the tokens it refers to are stored in table bugs.tokens, and that the size of the field is wrong in my installation after the upgrade (again).

mysql> use bugs;
mysql> describe tokens;
| Field | Type | Null | Key | Default | Extra |
| userid | mediumint(9) | YES | MUL | NULL | |
| issuedate | datetime | NO | | NULL | |
| token | varchar(5) | NO | PRI | NULL | |
| tokentype | varchar(8) | YES | | NULL | |
| eventdata | tinytext | YES | | NULL | |
5 rows in set (0.02 sec)

According to the published schema, token should be varchar(16). http://www.ravenbrook.com/project/p4dti/tool/cgi/bugzilla-schema/index.cgi?action=single&version=3.4.2&view=View+schema#table-tokens

To fix the problem I modified the data type as follows:

mysql> alter table tokens modify column token varchar(16) not null;
Query OK, 20 rows affected (0.32 sec)
Records: 20 Duplicates: 0 Warnings: 0

And then I was able to change my parameters.