Fix unignore command
This commit is contained in:
parent
23577b8981
commit
85761fef1a
@ -552,14 +552,19 @@ class StagingAPI(object):
|
||||
ignore[entry.get('id')] = entry.get('description')
|
||||
return ignore
|
||||
|
||||
@memoize(session=True)
|
||||
def add_ignored_request(self, request_id, comment):
|
||||
ignore = {}
|
||||
url = self.makeurl(['staging', self.project, 'excluded_requests'])
|
||||
root = ET.Element('excluded_requests')
|
||||
req = ET.SubElement(root, 'request', { 'number': str(request_id), 'description': comment })
|
||||
http_POST(url, data=ET.tostring(root))
|
||||
|
||||
def del_ignored_request(self, request_id):
|
||||
url = self.makeurl(['staging', self.project, 'excluded_requests'])
|
||||
root = ET.Element('excluded_requests')
|
||||
req = ET.SubElement(root, 'number')
|
||||
req.text = str(request_id)
|
||||
http_DELETE(url, data=ET.tostring(root))
|
||||
|
||||
@memoize(session=True, add_invalidate=True)
|
||||
def get_open_requests(self, query_extra=None, include_nonfree=True):
|
||||
"""
|
||||
|
@ -28,6 +28,7 @@ class UnignoreCommand(object):
|
||||
if request_id in requests_ignored:
|
||||
print('{}: unignored'.format(request_id))
|
||||
del requests_ignored[request_id]
|
||||
self.api.del_ignored_request(request_id)
|
||||
self.comment.add_comment(request_id=str(request_id), comment=self.MESSAGE)
|
||||
|
||||
if cleanup:
|
||||
@ -40,13 +41,6 @@ class UnignoreCommand(object):
|
||||
if diff.days > 3:
|
||||
print('Removing {} which was {} {} days ago'
|
||||
.format(request_id, request.state.name, diff.days))
|
||||
del requests_ignored[request_id]
|
||||
|
||||
diff = length - len(requests_ignored)
|
||||
if diff > 0:
|
||||
self.api.set_ignored_requests(requests_ignored)
|
||||
print('Unignored {} requests'.format(diff))
|
||||
else:
|
||||
print('No requests to unignore')
|
||||
self.api.del_ignored_request(request_id)
|
||||
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user