From 875cbc2b3860722149127f5007c1c371770b43d1 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 25 Aug 2022 16:09:40 +0200 Subject: [PATCH] chg: [nextcloud] enhance catching installation errors Signed-off-by: Valentin Lab --- nextcloud/lib/common | 13 ++++++++++--- nextcloud/src/fake-apache | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100755 nextcloud/src/fake-apache diff --git a/nextcloud/lib/common b/nextcloud/lib/common index 334b7dd..6b10366 100644 --- a/nextcloud/lib/common +++ b/nextcloud/lib/common @@ -93,9 +93,16 @@ create_occ_if_not_exists() { ## NEXTCLOUD_ADMIN_{USER,PASSWORD} that is required to trigger ## a full installation - export COMPOSE_IGNORE_ORPHANS=true - compose --debug --without-relation="$SERVICE_NAME":web-proxy run \ - --rm --entrypoint /entrypoint.sh "$SERVICE_NAME" apache >&2 || true + if ! out=$( + export COMPOSE_IGNORE_ORPHANS=true + compose --debug --without-relation="$SERVICE_NAME":web-proxy run \ + -v "$CHARM_PATH"/src/fake-apache:/usr/bin/apache \ + --rm --entrypoint /entrypoint.sh "$SERVICE_NAME" apache 2>&1 + ); then + err "Initialization of code or database failed unexpectedly" + e "$out" | prefix " | " + return 1 + fi if ! [ -e "$SERVICE_DATASTORE/var/www/html/occ" ]; then err "Expected last command to create /var/www/html/occ" return 1 diff --git a/nextcloud/src/fake-apache b/nextcloud/src/fake-apache new file mode 100755 index 0000000..3395065 --- /dev/null +++ b/nextcloud/src/fake-apache @@ -0,0 +1,3 @@ +#!/bin/bash + +true