From fcdfe9241d161fa18f33562c3a81d4f449b6754b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sun, 18 Sep 2022 10:13:37 +0200 Subject: [PATCH] Vars added to debugging output --- inventory_plugins/reconstructed.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/inventory_plugins/reconstructed.py b/inventory_plugins/reconstructed.py index 3642a28..45dd918 100644 --- a/inventory_plugins/reconstructed.py +++ b/inventory_plugins/reconstructed.py @@ -247,6 +247,8 @@ class RcInstruction(abc.ABC): flow.append( "loop=%s, loop_var=%s" % (repr(self._loop), repr(self._loop_var)) ) + if len(self._vars) != 0: + flow.append("vars=%s" % (repr(self._vars),)) if self._executed_once is not None: flow.append("run_once") if flow: @@ -272,12 +274,14 @@ class RcInstruction(abc.ABC): a list of strings (one for each line) """ output = [] - if self._condition is not None: - output.append("{when: %s}" % (repr(self._condition),)) - if self._loop is not None: - output.append("{loop[%s]: %s}" % (self._loop_var, repr(self._loop))) if self._executed_once is not None: output.append("{run_once}") + if self._loop is not None: + output.append("{loop[%s]: %s}" % (self._loop_var, repr(self._loop))) + for var in self._vars: + output.append("{var %s=%s}" % (var, repr(self._vars[var]))) + if self._condition is not None: + output.append("{when: %s}" % (repr(self._condition),)) output.extend(self.dump_instruction()) return output