Disabling the protect active flag (#498)

This commit is contained in:
kevgliss 2016-11-16 09:31:02 -08:00 committed by GitHub
parent e9219adfb5
commit eaf34b1c8b
1 changed files with 17 additions and 17 deletions

View File

@ -184,28 +184,28 @@ def update_destinations(target, value, initiator):
@event.listens_for(Certificate.replaces, 'append') @event.listens_for(Certificate.replaces, 'append')
def update_replacement(target, value, initiator): def update_replacement(target, value, initiator):
""" """
When a certificate is marked as 'replaced' it is then marked as in-active When a certificate is marked as 'replaced' we should not notify.
:param target: :param target:
:param value: :param value:
:param initiator: :param initiator:
:return: :return:
""" """
value.active = False value.notify = False
@event.listens_for(Certificate, 'before_update') # @event.listens_for(Certificate, 'before_update')
def protect_active(mapper, connection, target): # def protect_active(mapper, connection, target):
""" # """
When a certificate has a replacement do not allow it to be marked as 'active' # When a certificate has a replacement do not allow it to be marked as 'active'
#
:param connection: # :param connection:
:param mapper: # :param mapper:
:param target: # :param target:
:return: # :return:
""" # """
if target.active: # if target.active:
if not target.notify: # if not target.notify:
raise Exception( # raise Exception(
"Cannot silence notification for a certificate Lemur has been found to be currently deployed onto endpoints" # "Cannot silence notification for a certificate Lemur has been found to be currently deployed onto endpoints"
) # )