2
# -*- coding: utf-8 -*-
4
# Copyright (C) 2020 Canonical Ltd.
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; version 3 of the License.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
"""Close out remaining open bug tasks in Launchpad for an EOL series."""
21
from launchpadlib.launchpad import Launchpad
24
CONSUMER_KEY = "close-EOL-bugs"
26
def close_bugs_for_series(series):
27
bugs = series.searchTasks(status=('New', 'Confirmed', 'Incomplete',
28
'Triaged', 'In Progress',
31
message = ('%s has reached end of life, so this bug will not be fixed'
32
' for that release' % series.name)
35
task.status = "Won't Fix"
36
task.bug.newMessage(content=message)
39
def is_series_obsolete(series):
40
if series.status != 'Obsolete':
44
if __name__ == '__main__':
45
parser = argparse.ArgumentParser(
46
usage="%(prog)s [options] series")
49
"-l", "--launchpad", dest="launchpad_instance", default="production")
52
help="series to act on")
54
args = parser.parse_args()
56
launchpad = Launchpad.login_with(
57
CONSUMER_KEY, args.launchpad_instance, version="devel")
58
distro = launchpad.distributions["ubuntu"]
59
series = distro.getSeries(name_or_version=args.series)
61
if not is_series_obsolete(series):
62
print("Series %s is not obsolete, aborting." % args.series,
66
close_bugs_for_series(series)