From 23771fafc412b5a6e4969ec5421f21f3ad1000cf Mon Sep 17 00:00:00 2001 From: Mohamed El Mouctar HAIDARA Date: Wed, 17 Jul 2024 23:11:44 +0000 Subject: [PATCH] include_role in to_dict --- ansibleplaybookgrapher/graph_model.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ansibleplaybookgrapher/graph_model.py b/ansibleplaybookgrapher/graph_model.py index 0ad0eb5..7993ba3 100644 --- a/ansibleplaybookgrapher/graph_model.py +++ b/ansibleplaybookgrapher/graph_model.py @@ -299,7 +299,7 @@ def to_dict(self, exclude_compositions: bool = False, **kwargs) -> Dict: node only. :return: """ - node_dict: Dict = super().to_dict(**kwargs) + node_dict = super().to_dict(**kwargs) if not exclude_compositions: for composition, nodes in self._compositions.items(): @@ -630,3 +630,17 @@ def has_loop(self) -> bool: return False return super().has_loop() + + def to_dict(self, exclude_compositions: bool = False, **kwargs) -> Dict: + """ + Return a dictionary representation of this composite node. This representation is not meant to get the + original object back. + :param exclude_compositions: Whether to exclude the compositions from the dict or not. Applied to the current + node only. + :param kwargs: + :return: + """ + node_dict = super().to_dict(**kwargs) + node_dict["include_role"] = self.include_role + + return node_dict