From f6829b386ea086ebe849a45b205cf7216900b2dc Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 17 Jun 2020 05:58:47 +0530 Subject: [PATCH] [2.9] Typecast results before use in profile_tasks callback (#69665) If user specifies sort_order to none, results are not converted to list. This fix force this typecasting before using the results. Fixes: ansible/ansible#69563 Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/69563_profile_tasks.yml | 2 ++ lib/ansible/plugins/callback/profile_tasks.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/69563_profile_tasks.yml diff --git a/changelogs/fragments/69563_profile_tasks.yml b/changelogs/fragments/69563_profile_tasks.yml new file mode 100644 index 00000000000..ac4315f6ebd --- /dev/null +++ b/changelogs/fragments/69563_profile_tasks.yml @@ -0,0 +1,2 @@ +bugfixes: +- profile_tasks - typecast results before using it (https://github.com/ansible/ansible/issues/69563). diff --git a/lib/ansible/plugins/callback/profile_tasks.py b/lib/ansible/plugins/callback/profile_tasks.py index fedbba7dcee..dad832df4d5 100644 --- a/lib/ansible/plugins/callback/profile_tasks.py +++ b/lib/ansible/plugins/callback/profile_tasks.py @@ -184,7 +184,7 @@ class CallbackModule(CallbackBase): ) # Display the number of tasks specified or the default of 20 - results = results[:self.task_output_limit] + results = list(results)[:self.task_output_limit] # Print the timings for uuid, result in results: