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:
Nathaniel Case 2017-12-01 12:22:54 -05:00 committed by GitHub
parent 717b6e7c1a
commit 7f90c9d1a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 129 additions and 87 deletions

View file

@ -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