From 7892a258239cfb97d602517a5af5486a15db4f3f Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 28 Nov 2018 15:25:02 +0100 Subject: [PATCH] fix: [apache] avoid leaking stopped container when launching letsencrypt creation. --- apache/lib/common | 8 +++++--- apache/test/vhost_cert_provider | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apache/lib/common b/apache/lib/common index 8cdef50c..2b5779ef 100644 --- a/apache/lib/common +++ b/apache/lib/common @@ -216,9 +216,11 @@ ssl_plugin_cert-provider_prepare() { options=$(yaml_key_val_str "options" "$cfg") || return 1 service_config=$(yaml_key_val_str "$service" "$options") - compose --debug --add-compose-content "$service_config" run --service-ports "$service" \ - crt create "$DOMAIN" $(echo "$SERVER_ALIAS" | shyaml -y get-values 2>/dev/null) || return 1 - + compose --debug --add-compose-content "$service_config" run --rm --service-ports "$service" \ + crt create "$DOMAIN" $(echo "$SERVER_ALIAS" | shyaml -y get-values 2>/dev/null) || { + err "Failed to launch letsencrypt for certificate creation." + return 1 + } config-add "\ services: $MASTER_TARGET_SERVICE_NAME: diff --git a/apache/test/vhost_cert_provider b/apache/test/vhost_cert_provider index 33cc3fa7..77f1bfdb 100644 --- a/apache/test/vhost_cert_provider +++ b/apache/test/vhost_cert_provider @@ -137,7 +137,7 @@ ssl: RELATIONS=(cert-provider foo a True) apache_vhost_create" "known cert key" noerror -is out reg 'Calling: compose .*foo: options: .*run --service-ports foo.*' +is out reg 'Calling: compose .*foo: options: .*run --rm --service-ports foo.*' is out part 'config-add | services: | $MASTER_TARGET_SERVICE_NAME: