-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build a graph of resources. Use it to detect circular dependencies #1391
Conversation
Agreed, I think just documenting how to do that here is a nice compromise:
|
'networkx~=2.4;python_version>="3.5"', | ||
'networkx~=2.1;python_version<"3.5"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to vet new dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of license we should be ok: https://tldrlegal.com/license/bsd-3-clause-license-(revised)
Nice! From testing, Resource5:
Type: AWS::SNS::Topic
Properties:
DisplayName:
Fn::GetAtt: Resource6.TopicName # dependency only caught in !GetAtt form
# !GetAtt Resource6.TopicName
Resource6:
Type: AWS::SNS::Topic
Properties:
DisplayName:
Ref: Resource5 Pushed to your branch if you want to use for testing |
Another option is to put it behind a command or option and test for the existence of pydot if that's used. try:
import pydot
except ImportError:
# give some feedback here |
The new python-networkx dependency is from [1] [1] aws-cloudformation/cfn-lint#1391 git-svn-id: file:///srv/repos/svn-community/svn@602273 9fca08f4-af9d-4005-b8df-a31f2cc04f65
Changes:
networkx
to model the template as a graph of resourcesDependsOn
edges to the graphWhile debugging I found it very useful to use
networkx.drawing.nx_pydot.write_dot(self.graph, path)
which creates a visual representation of the graph. I think it would be useful for customers as well. But I wasn't sure whether to include it in this PR because it needs another dependency,pydot
and it would need some work to make it a fancy graph.