Fix fetching old style facts in junos_facts module (#42336)

* Fix fetching old style facts in junos_facts module

Fixes #42298
* To fetch old style facts from junos device it requires
  login credentials in provider, hence while using
  connection=nectonf do not delete provider values
  as it might not be ignored

* Add `ofacts` as one of the options in `gather_subset`

* Minor update in documentation

* Fix CI failure
This commit is contained in:
Ganesh Nalawade 2018-07-05 18:21:44 +05:30 committed by Sumit Jaiswal
parent 62e7a65459
commit 31dd41e4c5
2 changed files with 31 additions and 21 deletions

View file

@ -91,8 +91,11 @@ class ActionModule(_ActionModule):
elif self._play_context.connection in ('netconf', 'network_cli'):
provider = self._task.args.get('provider', {})
if any(provider.values()):
display.warning('provider is unnecessary when using %s and will be ignored' % self._play_context.connection)
del self._task.args['provider']
# for legacy reasons provider value is required for junos_facts(optional) and junos_package
# modules as it uses junos_eznc library to connect to remote host
if not (self._task.action == 'junos_facts' or self._task.action == 'junos_package'):
display.warning('provider is unnecessary when using %s and will be ignored' % self._play_context.connection)
del self._task.args['provider']
if (self._play_context.connection == 'network_cli' and self._task.action not in CLI_SUPPORTED_MODULES) or \
(self._play_context.connection == 'netconf' and self._task.action == 'junos_netconf'):