Skip to content

Commit

Permalink
Handling status for revoking request:modified
Browse files Browse the repository at this point in the history
  • Loading branch information
trishnaguha committed Feb 4, 2016
1 parent 59c6e9c commit ff2421f
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions bodhi/models/models.py
Expand Up @@ -1043,6 +1043,35 @@ def set_request(self, db, action, username):
update=self, agent=username))
return

# If status is pending going to testing request and action is revoke,
# set the status to unpushed
elif self.status is UpdateStatus.pending and self.request is UpdateRequest.testing \
and action is UpdateRequest.revoke:
self.status = UpdateStatus.unpushed
self.revoke()
flash_log("%s has been revoked." % self.title)
notifications.publish(topic=topic, msg=dict(
update=self, agent=username))
return

# If status is testing going to stable request and action is revoke,
# keep the status at testing
elif self.status is UpdateStatus.testing and self.request is UpdateRequest.stable \
and action is UpdateRequest.revoke:
self.status = UpdateStatus.testing
self.revoke()
flash_log("%s has been revoked." % self.title)
notifications.publish(topic=topic, msg=dict(
update=self, agent=username))
return

elif action is UpdateRequest.revoke:
self.revoke()
flash_log("%s has been revoked." % self.title)
notifications.publish(topic=topic, msg=dict(
update=self, agent=username))
return

# Disable pushing critical path updates for pending releases directly to stable
if action is UpdateRequest.stable and self.critpath:
if config.get('critpath.num_admin_approvals') is not None:
Expand Down Expand Up @@ -1106,28 +1135,6 @@ def set_request(self, db, action, username):
if not self.release.candidate_tag in self.get_tags():
self.add_tag(self.release.candidate_tag)

# If status is pending going to testing request and action is revoke,
# set the status to unpushed
if self.status is UpdateStatus.pending and self.request is UpdateRequest.testing \
and action is UpdateRequest.revoke:
self.status = UpdateStatus.unpushed
self.revoke()
flash_log("%s has been revoked." % self.title)
notifications.publish(topic=topic, msg=dict(
update=self, agent=username))
return

# If status is testing going to stable request and action is revoke,
# keep the status at testing
if self.status is UpdateStatus.testing and self.request is UpdateRequest.stable \
and action is UpdateRequest.revoke:
self.status = UpdateStatus.testing
self.revoke()
flash_log("%s has been revoked." % self.title)
notifications.publish(topic=topic, msg=dict(
update=self, agent=username))
return

self.request = action

notes = notes and '. '.join(notes) + '.' or ''
Expand Down

0 comments on commit ff2421f

Please sign in to comment.