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')
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 value:
:param initiator:
:return:
"""
value.active = False
value.notify = False
@event.listens_for(Certificate, 'before_update')
def protect_active(mapper, connection, target):
"""
When a certificate has a replacement do not allow it to be marked as 'active'
:param connection:
:param mapper:
:param target:
:return:
"""
if target.active:
if not target.notify:
raise Exception(
"Cannot silence notification for a certificate Lemur has been found to be currently deployed onto endpoints"
)
# @event.listens_for(Certificate, 'before_update')
# def protect_active(mapper, connection, target):
# """
# When a certificate has a replacement do not allow it to be marked as 'active'
#
# :param connection:
# :param mapper:
# :param target:
# :return:
# """
# if target.active:
# if not target.notify:
# raise Exception(
# "Cannot silence notification for a certificate Lemur has been found to be currently deployed onto endpoints"
# )