Exit when container is missing or empty when downloading logs

The workflow should exit early if the logging container isn't present or
is empty.  In that case, there aren't any logs to hand back to the
client so we're going to tell them that and fail.

Change-Id: I10747b593f8c5d4c81ae737e8bd279f8b312559c
Partial-Bug: 1803724
This commit is contained in:
Honza Pokorny 2018-11-16 13:47:08 -04:00
parent 9198805df8
commit 7c960d0bc0
1 changed files with 23 additions and 1 deletions

View File

@ -793,9 +793,31 @@ workflows:
publish_logs:
workflow: tripleo.plan_management.v1.publish_ui_logs_to_swift
on-success: prepare_log_download
on-success: check_if_logging_container_present
on-error: publish_logs_set_status_failed
check_if_logging_container_present:
workflow: tripleo.swift.v1.container_exists
input:
container: <% $.logging_container %>
on-error: set_container_empty_error
on-success: check_if_logging_files_present
check_if_logging_files_present:
action: swift.get_container
input:
container: <% $.logging_container %>
on-success:
- prepare_log_download: <% task().result[1].len() > 0 %>
- set_container_empty_error: <% task().result[1].len() = 0 %>
on-error: set_container_empty_error
set_container_empty_error:
on-success: send_message
publish:
status: FAILED
message: "There are no logs to download."
prepare_log_download:
action: tripleo.logging_to_swift.prepare_log_download
input: