-
Notifications
You must be signed in to change notification settings - Fork 237
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
Do not store failed connections in host attributes #497
Do not store failed connections in host attributes #497
Conversation
nornir/core/inventory.py
Outdated
|
||
self.connections.pop(connection).close() | ||
connection = self.connections.pop(conn_name) |
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.
this should actually trip mypy. You are storing a type
of some sort in a variable that was previously defined as a str
so maybe it's better to skip the conn_name
and rename this to conn = self.connections.pop(conn_name)
Excellent work, just a couple of minor comments but I am pre-approving it as they are very minor |
e1f4c07
to
fbe8b35
Compare
Awesome, thanks! |
With this fix failed connections are not stored in
host.connections
dictionary, which means we are not trying to close them, raising an exception.Besides fixing bug #350, this also now allows to have a transparent retry mechanism for tasks which work with connections. Previously, any retry on the host, connection to which has failed, would leave a connection attribute uninitialized and ultimately fail.