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.
33 lines
963 B
Python
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
|