From ddf50f01806255a18df9c53aed3ab918e9e0059c Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Thu, 7 Nov 2024 12:18:48 -0800 Subject: [PATCH] Fix an issue when printing the graph overwriting --- src/cfnlint/graph.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cfnlint/graph.py b/src/cfnlint/graph.py index e0ddf65e98..5dee664bcf 100644 --- a/src/cfnlint/graph.py +++ b/src/cfnlint/graph.py @@ -10,6 +10,7 @@ import json import logging import warnings +from copy import deepcopy from typing import Any import networkx @@ -308,7 +309,8 @@ def _find_parameter(self, string): # pylint: disable=import-outside-toplevel,unused-variable def to_dot(self, path): """Export the graph to a file with DOT format""" - view = self.settings.subgraph_view(self.graph) + graph = deepcopy(self.graph) + view = self.settings.subgraph_view(graph) try: networkx.drawing.nx_agraph.write_dot(view, path) except ImportError: