Added lp-tag.py tool that helps adding tags to bugs

This can be used for bulk tagging of bugs identified by some other
search filters. For example, for proactive backports effort, the script
can be used to mark identified candidates for backports in Launchpad for
later triaging.

While at it, for docs, made it a bit more explicit that
bugs-fixed-since.py script requires more parameters than just --start.

Change-Id: Icadacf534b03336dae6516eab59f7627c996ad80
This commit is contained in:
Ihar Hrachyshka 2016-05-27 18:55:56 +02:00
parent 1bff8b4514
commit e3bcd0e6a7
2 changed files with 63 additions and 3 deletions

View File

@ -898,7 +898,7 @@ importance specified. Filtering out Wishlist bugs if importance not specified.
Example::
./bugs-fixed-since.py --start=8.0.0 | \
./bugs-fixed-since.py [...] --start=8.0.0 | \
./lp-filter-bugs-by-importance.py neutron
List bugs that are fixed in master since 8.0.0 that are not of Wishlist
@ -922,7 +922,7 @@ a tag specified.
Example::
./bugs-fixed-since.py --start=8.0.0 | \
./bugs-fixed-since.py [...] --start=8.0.0 | \
./lp-filter-bugs-by-tag.py neutron --tag in-stable-mitaka
List bugs that are fixed in master since 8.0.0 that don't have relevant fixes
@ -937,7 +937,7 @@ detailed description for each of them.
Example::
./bugs-fixed-since.py --start=8.0.0 | ./annotate-lp-bugs neutron
./bugs-fixed-since.py [...] --start=8.0.0 | ./annotate-lp-bugs neutron
Pull in detailed description for bugs that are fixed in master since 8.0.0.
@ -950,3 +950,15 @@ Clean up <*>-backport-potential tags for bugs with in-stable-<*> tag set.
Example::
./lp-reset-backport-potential.py neutron python-neutronclient
lp-tag.py
---------
Append a tag to bugs specified on stdin.
Example::
./bugs-fixed-since.py [...] --start=8.0.0 | ./lp-tag.py foo-tag
This command will add the 'foo-tag' tag to all bugs fixed since 8.0.0.

48
lp-tag.py Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
This Launchpad tool is used to tag bugs with a tag.
"""
import argparse
import sys
from launchpadlib.launchpad import Launchpad
def _parse_args():
parser = argparse.ArgumentParser(
description='Tag tags with a tag.')
parser.add_argument(
'tag', help='Tag to use')
return parser.parse_args()
def main():
args = _parse_args()
lp = Launchpad.login_with('openstack-releasing', 'production')
bugnums = [line.strip() for line in sys.stdin.readlines()]
for bugnum in bugnums:
bug = lp.bugs[bugnum]
tag = args.tag
tags = bug.tags
if tag not in tags:
tags.append(tag)
bug.tags = tags
bug.lp_save()
if __name__ == '__main__':
main()