Merge branch 'master' into powerdnsplugin_02
This commit is contained in:
commit
e4bba5c6e9
|
@ -332,7 +332,7 @@ def clean_all_sources():
|
||||||
metrics.send(f"{function}.success", 'counter', 1)
|
metrics.send(f"{function}.success", 'counter', 1)
|
||||||
|
|
||||||
|
|
||||||
@celery.task(soft_time_limit=600)
|
@celery.task(soft_time_limit=3600)
|
||||||
def clean_source(source):
|
def clean_source(source):
|
||||||
"""
|
"""
|
||||||
This celery task will clean the specified source. This is a destructive operation that will delete unused
|
This celery task will clean the specified source. This is a destructive operation that will delete unused
|
||||||
|
|
|
@ -24,6 +24,12 @@ def retry_throttled(exception):
|
||||||
if exception.response["Error"]["Code"] == "NoSuchEntity":
|
if exception.response["Error"]["Code"] == "NoSuchEntity":
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# No need to retry deletion requests if there is a DeleteConflict error.
|
||||||
|
# This error indicates that the certificate is still attached to an entity
|
||||||
|
# and cannot be deleted.
|
||||||
|
if exception.response["Error"]["Code"] == "DeleteConflict":
|
||||||
|
return False
|
||||||
|
|
||||||
metrics.send("iam_retry", "counter", 1, metric_tags={"exception": str(exception)})
|
metrics.send("iam_retry", "counter", 1, metric_tags={"exception": str(exception)})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,13 @@ def execute_clean(plugin, certificate, source):
|
||||||
try:
|
try:
|
||||||
plugin.clean(certificate, source.options)
|
plugin.clean(certificate, source.options)
|
||||||
certificate.sources.remove(source)
|
certificate.sources.remove(source)
|
||||||
|
|
||||||
|
# If we want to remove the source from the certificate, we also need to clear any equivalent destinations to
|
||||||
|
# prevent Lemur from re-uploading the certificate.
|
||||||
|
for destination in certificate.destinations:
|
||||||
|
if destination.label == source.label:
|
||||||
|
certificate.destinations.remove(destination)
|
||||||
|
|
||||||
certificate_service.database.update(certificate)
|
certificate_service.database.update(certificate)
|
||||||
return SUCCESS_METRIC_STATUS
|
return SUCCESS_METRIC_STATUS
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue