mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-01 12:40:22 -07:00
Report invalid connection types for network modules (#34755)
* Emit error on wrong connection type
This commit is contained in:
parent
74ac1c2e4a
commit
bd989b3088
7 changed files with 21 additions and 3 deletions
|
@ -101,6 +101,8 @@ class ActionModule(_ActionModule):
|
|||
provider['authorize'] = False
|
||||
|
||||
self._task.args['provider'] = provider
|
||||
else:
|
||||
return {'failed': True, 'msg': 'Connection type %s is not valid for this module' % self._play_context.connection}
|
||||
|
||||
if (self._play_context.connection == 'local' and transport == 'cli') or self._play_context.connection == 'network_cli':
|
||||
# make sure we are in the right cli context which should be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue