-
-
Save imcsk8/a5f2d7700ccba2b3565376024ca390c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bugzilla Script to close ALL EOL Bugs | |
# Author : Chandan Kumar <[email protected]> | |
# | |
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment