Skip to content

Commit

Permalink
Implement connection reset. (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored Mar 22, 2022
1 parent b353a39 commit 3c7c496
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/312-docker-connection-reset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- "docker connection plugin - implement connection reset by clearing internal container user cache (https://github.com/ansible-collections/community.docker/pull/312)."
- "docker_api connection plugin - implement connection reset by clearing internal container user/group ID cache (https://github.com/ansible-collections/community.docker/pull/312)."
4 changes: 4 additions & 0 deletions plugins/connection/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,7 @@ def close(self):
""" Terminate the connection. Nothing to do for Docker"""
super(Connection, self).close()
self._connected = False

def reset(self):
# Clear container user cache
self._container_user_cache = {}
3 changes: 3 additions & 0 deletions plugins/connection/docker_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,6 @@ def close(self):
""" Terminate the connection. Nothing to do for Docker"""
super(Connection, self).close()
self._connected = False

def reset(self):
self.ids.clear()

0 comments on commit 3c7c496

Please sign in to comment.