Skip to content

Instantly share code, notes, and snippets.

@chkumar246
Last active May 30, 2016 20:16
Show Gist options
  • Save chkumar246/23237abe5203d963054092fd989a2b88 to your computer and use it in GitHub Desktop.
Save chkumar246/23237abe5203d963054092fd989a2b88 to your computer and use it in GitHub Desktop.
# Bugzilla Script to close ALL EOL Bugs
# Author : Chandan Kumar <chkumar246@gmail.com>
#
# How to Run this script:
# $ python close_eol_bugs.py
import bugzilla
import getpass
BZ_URL = "https://bugzilla.redhat.com"
BZ_USER = "<Bugzilla Username>"
EOL_MSG = "This bug is against a Version which has reached End of Life.\n" "If it's still present in supported release (http://releases.openstack.org), please update Version and reopen."
TARGET_RELEASE = ["Icehouse", "Juno", "Kilo"]
PRODUCT = "RDO"
RESOLUTION = "EOL"
def get_bz_obj():
"""
Get Bugzilla Object to perform further query
"""
bz = bugzilla.Bugzilla(url=BZ_URL, user=BZ_USER,
password=getpass.getpass(prompt='Enter your Bugzilla Password:'))
return bz
def get_eol_bugs():
"""
Returns a list of EOL Bugzilla objects
"""
bz = get_bz_obj()
bugs = bz.query(bz.build_query(product=PRODUCT))
eol_bugs = [bug for bug in bugs if bug.target_release[0] in TARGET_RELEASE and bug.status != "CLOSED"]
return eol_bugs
def close_eol_bug_with_eolmsg(bzobj):
"""
Close eol bug with a proper msg and resolution
"""
bzobj.close(RESOLUTION, comment=EOL_MSG)
print "%s is CLOSED successfully" % bzobj.weburl
def close_all_eolbugs():
"""
Close all EOL bugs with Message
"""
eol_obj = get_eol_bugs()
for bug in eol_obj:
close_eol_bug_with_eolmsg(bug)
if __name__ == '__main__':
eol_bzs = get_eol_bugs()
print "%d EOL Bugs Found" % len(eol_bzs)
close_eol_bug_with_eolmsg(eol_bzs[0])
# TO CLOSE EOL Bugs in one GO
# close_all_eolbugs()
@chkumar246
Copy link
Author

@yac The script is updated with the EOL message. Thanks for the pointer.

@chkumar246
Copy link
Author

Improve script to skip some component irrespective of the target-release

@sankarshanmukhopadhyay
Copy link

'End-of-Life' is a software development term which may not be intuitive and obvious to all the users who filed the bugs. I'd request re-purposing the text that is used by the Fedora Project.

The Fedora Project uses the following stock response https://fedoraproject.org/wiki/BugZappers/StockBugzillaResponses#End_of_Life_.28EOL.29_product

Thank you for your bug report.
We are sorry, but the Fedora Project is no longer releasing bug fixes or any other updates for this version of Fedora. This bug will be set to CLOSED:WONTFIX to reflect this, but please reopen it if the problem persists after upgrading to the latest version of Fedora, which is available from: http://fedoraproject.org/get-fedora

@chkumar246
Copy link
Author

@sankarshanmukhopadhyay The above RDO EOL statement is decided in RDO meeting and we have evaluated Fedora EOL statement before coming to conclusion and then we come to conclusion to keep it short.
Here is the link for RDO meeting: https://meetbot.fedoraproject.org/teams/rdo_meeting_(2016-05-18)/rdo_meeting_(2016-05-18).2016-05-18-15.00.log.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment