Skip to main content

Models and scripts to access the Bugzilla REST API.

Project description

This package currently uses `remoteobjects`_ models, Mozilla's `_ Bugzilla `REST API`_, and optionally the Mozilla LDAP `phonebook`_ (to access bug assignees' managers & Mozilla email addresses).

.. _remoteobjects:
.. _phonebook:


Currently, this package depends on a pre-release version of remoteobjects, so
we'll have to do this the long way.

#. Check out the code::

git clone git://

#. (optional) Create your virtualenv using virtualenvwrapper::

mkvirtualenv --no-site-packages bztools

#. Install pip::

easy_install pip

#. Install the dependencies for bztools::

pip install -r requirements.txt

#. Run so the scripts are installed to your bin directory::

python install

Now you'll have ``bzattach`` installed in the ``/bin`` directory of your
virtual environment. To use the script, you'll have to activate this
environment with ``workon bztools``.

Note to developers: if you make any changes to the bugzilla/ files (agents, models, utils) during
work on other scripts, you will want to re-install the scripts as instructed above in order to pick
up changes



from bugzilla.agents import BMOAgent
from bugzilla.utils import get_credentials

# We can use "None" for both instead to not authenticate
username, password = get_credentials()

# Load our agent for BMO
bmo = BMOAgent(username, password)

# Set whatever REST API options we want
options = {
'changed_after': '2010-12-24',
'changed_before': '2010-12-26',
'changed_field': 'status',
'changed_field_to': 'RESOLVED',
'product': 'Core,Firefox',
'resolution': 'FIXED',
'include_fields': '_default,attachments',

# Get the bugs from the api
buglist = bmo.get_bug_list(options)

print "Found %s bugs" % (len(buglist))

for bug in buglist:
print bug

Email Nag Script
Do a dryrun::
python scripts/ -d -q queries/tracking_firefox_12 -q queries/tracking_firefox_13

You can pass in several config files (examples in queries/) that should have the following information::
query_{url,params} (choose one format - see queries/ for examples of each)

The script does the following:
* Gathers the current list of employees and managers from Mozilla LDAP phonebook
** you will need a local config for phonebook auth with your LDAP info::
# in scripts/configs/config.json ▸▸▸▸▸▸▸▸▸▸
"username": "",
"password": "xxxxxxxxxxxxxx"
* Polls the bugzilla API with each query supplied and builds a dictionary of bugs found per query
* For each bug, finds the assignee and if possible the assignee's manager - then adds the bug to the manager's bug bucket for later email notification
* Goes through the manager dictionary and contructs an email with the bugs assigned to that manager's team members
* Outputs the message to console and waits for use input to either send/edit/cancel (save for manual notification)
* At the end it provides a list of all bugs that were not emailed about and provides the url for bugzilla of that buglist

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
bztools-0.0.2.tar.gz (17.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page