openSUSE-release-tools/osclib/ignore_command.py
2019-11-19 08:04:11 +01:00

25 lines
800 B
Python

from osc.core import get_request
from osclib.comments import CommentAPI
from osclib.request_finder import RequestFinder
class IgnoreCommand(object):
MESSAGE = 'Ignored: removed from active backlog.'
def __init__(self, api):
self.api = api
self.comment = CommentAPI(self.api.apiurl)
def perform(self, requests, message=None):
"""
Ignore a request from "list" and "adi" commands until unignored.
"""
for request_id in RequestFinder.find_sr(requests, self.api):
print('{}: ignored'.format(request_id))
comment = message if message else self.MESSAGE
self.api.add_ignored_request(request_id, comment)
self.comment.add_comment(request_id=str(request_id), comment=comment)
return True