openSUSE-release-tools/osclib/unignore_command.py
Jimmy Berry b25fda9b47 Provide ignore/unignore request staging commands.
It is not uncommon for a request to be in a pending state which requires
action beyond the scope of the staging workflow, but does not make sense
to deny the request. For lack of a "postponed" or "pending" state on OBS
a sudo-state of "ignore" is provided for the staging workflow. The ignore
state will remove a request from the "list" and "adi" commands so as not
to be accidentally staged. This avoids the need for keeping a context of
what requests should be ignored in one's memory.

It is expected that an ignored request will have comments reflecting what
is to be done or one should be added via the -m option of ignore command.
2017-01-11 18:32:23 -06:00

33 lines
963 B
Python

from osc.core import get_request
class UnignoreCommand(object):
def __init__(self, api):
self.api = api
def perform(self, request_ids):
"""
Unignore a request by removing from ignore list.
"""
requests_ignored = self.api.get_ignored_requests()
length = len(requests_ignored)
if len(request_ids) == 1 and request_ids[0] == 'all':
requests_ignored = {}
else:
for request_id in request_ids:
request_id = int(request_id)
if request_id in requests_ignored:
print('Removing {}'.format(request_id))
del requests_ignored[request_id]
diff = length - len(requests_ignored)
if diff > 0:
print('Unignoring {} requests'.format(diff))
self.api.set_ignored_requests(requests_ignored)
else:
print('No requests to unignore')
return True