mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Fixes to httpapi for EAPI (#40675)
* Replace errant uses of str * Hook up become to eapi * Hook become up to nxapi, too
This commit is contained in:
parent
38c86b7eef
commit
0ad4b7b785
4 changed files with 36 additions and 17 deletions
|
@ -188,6 +188,8 @@ class Connection(ConnectionBase):
|
|||
|
||||
self._httpapi = httpapi_loader.get(network_os, self)
|
||||
if self._httpapi:
|
||||
if hasattr(self._httpapi, 'set_become'):
|
||||
self._httpapi.set_become(play_context)
|
||||
display.vvvv('loaded API plugin for network_os %s' % network_os, host=self._play_context.remote_addr)
|
||||
else:
|
||||
raise AnsibleConnectionFailure('unable to load API plugin for network_os %s' % network_os)
|
||||
|
@ -229,13 +231,8 @@ class Connection(ConnectionBase):
|
|||
play_context.deserialize(pc_data)
|
||||
|
||||
messages = ['updating play_context for connection']
|
||||
if self._play_context.become is False and play_context.become is True:
|
||||
self._enable = True
|
||||
messages.append('authorizing connection')
|
||||
|
||||
elif self._play_context.become is True and not play_context.become:
|
||||
self._enable = False
|
||||
messages.append('deauthorizing connection')
|
||||
if self._play_context.become ^ play_context.become:
|
||||
self._httpapi.set_become(play_context)
|
||||
|
||||
self._play_context = play_context
|
||||
return messages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue