This commit is contained in:
Hossein Shafagh 2020-03-14 20:18:07 -07:00
parent 593c35776c
commit c96695c966
1 changed files with 12 additions and 8 deletions

View File

@ -54,6 +54,17 @@ def validate_sources(source_strings):
return sources return sources
def execute_clean(plugin, certificate, source):
try:
plugin.clean(certificate, source.options)
certificate.sources.remove(source)
certificate_service.database.update(certificate)
return SUCCESS_METRIC_STATUS
except Exception as e:
current_app.logger.exception(e)
sentry.captureException()
@manager.option( @manager.option(
"-s", "-s",
"--sources", "--sources",
@ -147,14 +158,7 @@ def clean(source_strings, commit):
for certificate in certificate_service.get_all_pending_cleaning(source): for certificate in certificate_service.get_all_pending_cleaning(source):
status = FAILURE_METRIC_STATUS status = FAILURE_METRIC_STATUS
if commit: if commit:
try: status = execute_clean(s, certificate, source)
s.clean(certificate, source.options)
certificate.sources.remove(source)
certificate_service.database.update(certificate)
status = SUCCESS_METRIC_STATUS
except Exception as e:
current_app.logger.exception(e)
sentry.captureException()
metrics.send( metrics.send(
"clean", "clean",