Skip to content

Instantly share code, notes, and snippets.

@JacobCallahan
Last active September 26, 2019 15:32
Show Gist options
  • Save JacobCallahan/f9e5e952ffa609e8eee2eaeaf2e01409 to your computer and use it in GitHub Desktop.
Save JacobCallahan/f9e5e952ffa609e8eee2eaeaf2e01409 to your computer and use it in GitHub Desktop.
How to update bugs, without sending an email, in the CLI
For this, we will be using the python-bugzilla module
pip install python-bugzilla
This provides 'bugzilla' command, which is the interface we'll be using.
bugzilla has a "modify" sub command which allows us to update a bug via the CLI.
The most important piece of this is to pass the following argument, which surpresses email updates.
--field=minor_update=1
To update a single bug, you can either login via the 'login' subcommand or pass your username and password at run time.
bugzilla login
bugzilla modify --flag qa_ack+ --field=minor_update=1 12345678 (12345678) is the bug id
or
bugzilla modify --username myname@redhat.com --password 12345 --flag qa_ack+ --field=minor_update=1 12345678
If you are doing multiple updates you can either add them all as space delimited entries on the end of the bugzilla command, or you can create a text file with all the ids.
The second option allows you to iterate over each id, to lessen the chances of a bugzilla timeout.
An example of how to update the qe_test_coverage flag to - for all bugs in the list.
for id in $(cat bugids.txt); do echo $id && bugzilla modify --flag qe_test_coverage- --field=minor_update=1 $id; done
Adding awk to the mix let's you paste all the bugs in a page diectly into a file and run the updates off of that.
for id in $(awk '{print $1}' buglist.txt); do echo $id && bugzilla modify --flag qe_test_coverage- --field=minor_update=1 $id; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment