mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-03 06:49:10 -07:00
Handle remote_addr change in lxc connection plugin (#7373)
* Stopped container error test * Handle remote_addr change Detect if the remote_addr option changed, and properly "reconnect" aka update the internal state of the plugin instance. * Add changelog fragment * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
33133f3ba9
commit
3ae19aa28f
3 changed files with 65 additions and 4 deletions
|
@ -71,10 +71,11 @@ class Connection(ConnectionBase):
|
|||
msg = "lxc python bindings are not installed"
|
||||
raise errors.AnsibleError(msg)
|
||||
|
||||
if self.container:
|
||||
container_name = self.get_option('remote_addr')
|
||||
if self.container and self.container_name == container_name:
|
||||
return
|
||||
|
||||
self.container_name = self.get_option('remote_addr')
|
||||
self.container_name = container_name
|
||||
|
||||
self._display.vvv("THIS IS A LOCAL LXC DIR", host=self.container_name)
|
||||
self.container = _lxc.Container(self.container_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue