Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions library/network_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ def _complete_kwargs_loglines(self, rr, connections, idx):
)

def _complete_kwargs(self, connections, kwargs, traceback_msg=None, fail=False):
warning_logs = kwargs.get("warnings", [])
warning_logs = kwargs.pop("warnings", [])
debug_logs = []
loglines = []
for res in self._run_results:
Expand All @@ -1866,7 +1866,12 @@ def _complete_kwargs(self, connections, kwargs, traceback_msg=None, fail=False):
warning_logs.append(log_line)
if traceback_msg is not None:
warning_logs.append(traceback_msg)
kwargs["warnings"] = warning_logs
# see if the module object has the "warn" function
if callable(getattr(self.module, "warn", None)):
for msg in warning_logs:
self.module.warn(msg)
else:
kwargs["warnings"] = warning_logs
stderr = "\n".join(debug_logs) + "\n"
kwargs["stderr"] = stderr
kwargs["_invocation"] = {"module_args": self.module.params}
Expand Down
Loading