better error handling and log messages in network_cli (#20204)
This commit is contained in:
parent
3f949358c7
commit
fec773a2b4
1 changed files with 13 additions and 5 deletions
|
@ -72,16 +72,24 @@ class Connection(_Connection):
|
|||
network_os = self._play_context.network_os
|
||||
if not network_os:
|
||||
for cls in terminal_loader.all(class_only=True):
|
||||
try:
|
||||
network_os = cls.guess_network_os(self.ssh)
|
||||
if network_os:
|
||||
break
|
||||
except:
|
||||
raise AnsibleConnectionFailure(
|
||||
'Unable to automatically determine host network os. '
|
||||
'Please manually configure ansible_network_os value '
|
||||
'for this host'
|
||||
)
|
||||
|
||||
if not network_os:
|
||||
raise AnsibleConnectionFailure(
|
||||
'unable to determine device network os. Please configure '
|
||||
'ansible_network_os value'
|
||||
'Unable to automatically determine host network os. Please '
|
||||
'manually configure ansible_network_os value for this host'
|
||||
)
|
||||
|
||||
|
||||
self._terminal = terminal_loader.get(network_os, self)
|
||||
if not self._terminal:
|
||||
raise AnsibleConnectionFailure('network os %s is not supported' % network_os)
|
||||
|
|
Loading…
Reference in a new issue