From 3725053b33649caca943a4130e39a383f3aef700 Mon Sep 17 00:00:00 2001 From: Jana Cupova Date: Wed, 10 Apr 2024 12:57:36 +0200 Subject: [PATCH] taskinfo CLI and webUI info message why output is not in the list Fixes: https://pagure.io/koji/issue/4074 --- cli/koji_cli/commands.py | 11 +++++++++-- tests/test_cli/test_taskinfo.py | 18 ++++++++++++++++++ www/kojiweb/taskinfo.chtml | 3 +++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index a44dcaa0..dece662c 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -4845,14 +4845,21 @@ def _printTaskInfo(session, task_id, topdir, level=0, recurse=True, verbose=True for root in buildroot_infos: print("%s %s/%s-%d-%d/" % (indent, BUILDDIR, root['tag_name'], root['id'], root['repo_id'])) + print("%sLog Files:" % indent) if logs: - print("%sLog Files:" % indent) for log_path in logs: print("%s %s" % (indent, log_path)) + else: + print("%s No outputs reported [1]" % indent) + print("%sOutput:" % indent) if output: - print("%sOutput:" % indent) for file_path in output: print("%s %s" % (indent, file_path)) + else: + print("%s No outputs reported [1]" % indent) + if not logs or not output: + print("%s[1] Not all tasks produce outputs, and task outputs are not retained " + "indefinitely." % indent) # white space print('') diff --git a/tests/test_cli/test_taskinfo.py b/tests/test_cli/test_taskinfo.py index 3e72928f..9796bd8f 100644 --- a/tests/test_cli/test_taskinfo.py +++ b/tests/test_cli/test_taskinfo.py @@ -407,6 +407,11 @@ State: closed Created: Thu Jan 1 00:16:40 1970 Started: Thu Jan 1 00:33:20 1970 Finished: Thu Jan 1 00:50:00 1970 +Log Files: + No outputs reported [1] +Output: + No outputs reported [1] +[1] Not all tasks produce outputs, and task outputs are not retained indefinitely. Task: 2 Type: createrepo @@ -421,6 +426,9 @@ Finished: Thu Jan 1 00:50:00 1970 Log Files: %s %s + Output: + No outputs reported [1] + [1] Not all tasks produce outputs, and task outputs are not retained indefinitely. """ % tuple('/mnt/koji/work/tasks/2/2/' + k for k in task_output.keys()) @@ -520,6 +528,11 @@ Started: Thu Jan 1 00:33:20 1970 Finished: Thu Jan 1 00:50:00 1970 Host: kojibuilder Build: bash-4.4.12-5.fc26 (1) +Log Files: + No outputs reported [1] +Output: + No outputs reported [1] +[1] Not all tasks produce outputs, and task outputs are not retained indefinitely. Task: 2 Type: buildArch @@ -562,6 +575,11 @@ Build: bash-4.4.12-5.fc26 (1) Started: Thu Jan 1 00:33:20 1970 Finished: Thu Jan 1 00:50:00 1970 Host: kojibuilder + Log Files: + No outputs reported [1] + Output: + No outputs reported [1] + [1] Not all tasks produce outputs, and task outputs are not retained indefinitely. """ with mock.patch('sys.stdout', new_callable=six.StringIO) as stdout: diff --git a/www/kojiweb/taskinfo.chtml b/www/kojiweb/taskinfo.chtml index cc04330c..de0b04c2 100644 --- a/www/kojiweb/taskinfo.chtml +++ b/www/kojiweb/taskinfo.chtml @@ -269,6 +269,9 @@ $value #end if
#end for + #if not $output +
No outputs reported
+ #end if #if $task.state not in ($koji.TASK_STATES.CLOSED, $koji.TASK_STATES.CANCELED, $koji.TASK_STATES.FAILED) and \ $task.method in ('buildSRPMFromSCM', 'buildArch', 'createLiveMedia', 'buildMaven', 'wrapperRPM', 'vmExec', 'createrepo', 'runroot', 'createAppliance', 'createLiveCD')