From ec34b35a7fc57b893f71392844eef58e0ad13012 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 29 Jul 2018 19:32:05 -0400 Subject: [PATCH] feat: allow retrieving failed logs for all apps --- plugins/logs/subcommands/failed | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/logs/subcommands/failed b/plugins/logs/subcommands/failed index 24cb441f3..40371af19 100755 --- a/plugins/logs/subcommands/failed +++ b/plugins/logs/subcommands/failed @@ -1,15 +1,29 @@ #!/usr/bin/env bash -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/apps/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x cmd-logs-failed() { declare desc="shows the last failed deploy logs for an app" declare cmd="logs:failed" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1 declare APP="$1" local DOKKU_SCHEDULER - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" + if [[ -z "$APP" ]]; then + local INSTALLED_APPS=$(dokku_apps) + for app in $INSTALLED_APPS; do + fn-logs-failed-single "$app" | tee || true + done + else + fn-logs-failed-single "$app" + fi +} + +fn-logs-failed-single() { + declare desc="shows the last failed deploy logs for an app" + declare APP="$1" + local DOKKU_SCHEDULER DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local") plugn trigger scheduler-logs-failed "$DOKKU_SCHEDULER" "$APP" }