From ea238c9eb5e46d63b99f9bd81209eaa3d5e6ab9e Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 24 Jul 2025 21:35:30 -0700 Subject: [PATCH] tqm: Use correct warning methods (#85434) * Use display.error_as_warning instead of self.warning * Use display.error_as_warning instead of display.warning_as_error. Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/tqm.yml | 4 ++++ lib/ansible/executor/task_queue_manager.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/tqm.yml diff --git a/changelogs/fragments/tqm.yml b/changelogs/fragments/tqm.yml new file mode 100644 index 00000000000..d73157a8d51 --- /dev/null +++ b/changelogs/fragments/tqm.yml @@ -0,0 +1,4 @@ +--- +bugfixes: + - tqm - use display.error_as_warning instead of self.warning. + - tqm - use display.error_as_warning instead of display.warning_as_error. diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index c02f2b3a4f9..c48f3b9bb00 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -179,7 +179,7 @@ class TaskQueueManager: for fd in (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): os.set_inheritable(fd, False) except Exception as ex: - self.warning(f"failed to set stdio as non inheritable: {ex}") + display.error_as_warning("failed to set stdio as non inheritable", exception=ex) self._callback_lock = threading.Lock() @@ -269,7 +269,7 @@ class TaskQueueManager: display.warning("Skipping callback '%s', as it does not create a valid plugin instance." % callback_name) continue except Exception as ex: - display.warning_as_error(f"Failed to load callback plugin {callback_name!r}.", exception=ex) + display.error_as_warning(f"Failed to load callback plugin {callback_name!r}.", exception=ex) continue def run(self, play):