mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Warn on provider
with network_cli (#33355)
* Warn on `provider` with network_cli also unify action plugins * Add to porting guide about connection warnings
This commit is contained in:
parent
717b6e7c1a
commit
7f90c9d1a7
8 changed files with 129 additions and 87 deletions
|
@ -39,11 +39,14 @@ except ImportError:
|
|||
class ActionModule(_ActionModule):
|
||||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
|
||||
socket_path = None
|
||||
if self._play_context.connection == 'local':
|
||||
provider = load_provider(iosxr_provider_spec, self._task.args)
|
||||
|
||||
if self._play_context.connection == 'network_cli':
|
||||
provider = self._task.args.get('provider', {})
|
||||
if any(provider.values()):
|
||||
display.warning('provider is unnecessary when using network_cli and will be ignored')
|
||||
elif self._play_context.connection == 'local':
|
||||
provider = load_provider(iosxr_provider_spec, self._task.args)
|
||||
pc = copy.deepcopy(self._play_context)
|
||||
pc.connection = 'network_cli'
|
||||
pc.network_os = 'iosxr'
|
||||
|
@ -78,5 +81,4 @@ class ActionModule(_ActionModule):
|
|||
out = conn.get_prompt()
|
||||
|
||||
result = super(ActionModule, self).run(tmp, task_vars)
|
||||
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue