def build_graph(self): """Generates a DOT representation of the template""" g = Graph(self) path = self.filename + '.dot' try: g.to_dot(path) LOGGER.info('DOT representation of the graph written to %s', path) except ImportError: LOGGER.error( 'Could not write the graph in DOT format. Please install either `pygraphviz` or `pydot` modules.')
def match(self, cfn): matches = [] graph = Graph(cfn) for cycle in graph.get_cycles(cfn): source, target = cycle[:2] message = 'Circular Dependencies for resource {0}. Circular dependency with [{1}]'.format( source, target) path = ['Resources', source] matches.append(RuleMatch(path, message)) return matches