1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/lib/ansible/plugins
Pilou 2fd18c77ae openshift inventory plugin: fix exception when auth fails (#45826)
* openshift inventory: fix exception when auth fails

Fix 'ForbiddenError' object has no attribute 'message':

    [WARNING]:  * Failed to parse test.yml with openshift plugin: 'ForbiddenError' object has no attribute 'message'
     File "ansible/lib/ansible/inventory/manager.py", line 270, in parse_source
       plugin.parse(self._inventory, self._loader, source, cache=cache)
     File "ansible/lib/ansible/plugins/inventory/openshift.py", line 122, in parse
       self.setup(config_data, cache, cache_key)
     File "ansible/lib/ansible/module_utils/k8s/inventory.py", line 58, in setup
       self.fetch_objects(connections)
     File "ansible/lib/ansible/module_utils/k8s/inventory.py", line 250, in fetch_objects
       super(OpenShiftInventoryHelper, self).fetch_objects(connections)
     File "ansible/lib/ansible/module_utils/k8s/inventory.py", line 81, in fetch_objects
       namespaces = self.get_available_namespaces(client)
     File "ansible/lib/ansible/module_utils/k8s/inventory.py", line 95, in get_available_namespaces
       raise K8sInventoryException('Error fetching Namespace list: {0}'.format(exc.message))

Don't try to get 'message' attribute from:
- K8sInventoryException instances
- Exception instances
- KubernetesException instances (because KubernetesException can be
  Exception)

* move k8s/OpenShift inventory plugin dedicated code

inventory plugin specific code should not be located in
lib/ansible/module_utils directory. Then ansible.utils methods can be
reused (for example Display).

* Remove unused class variables 'helper'

unused since 4d77878654.
2018-09-26 18:16:54 -04:00
..
action Ensure that the src file contents is converted to unicode in diff info (#45744) 2018-09-20 12:31:48 -05:00
cache Fix _uri option documentation for cache plugins that expect strings 2018-09-25 09:57:03 -04:00
callback Add number of skipped tasks to play recap in 'default' callback (#45797) 2018-09-20 14:38:54 -04:00
cliconf Additional feature enhancements to nxos_logging (#45844) 2018-09-25 11:02:09 +05:30
connection winrm: add further conditional to using pexect for kerb auth (#45952) 2018-09-25 09:21:22 +10:00
filter allow jinja2 unique filter compat (#45637) 2018-09-25 14:27:02 -04:00
httpapi Store Authorization header inside HttpApi connection plugin (#45598) 2018-09-13 19:34:30 +05:30
inventory openshift inventory plugin: fix exception when auth fails (#45826) 2018-09-26 18:16:54 -04:00
lookup Update yaml-style in password-lookup example (#46046) 2018-09-24 09:34:12 +02:00
netconf Move persistent connections to only use registered variables (#45616) 2018-09-20 09:56:43 -04:00
shell powershell: do not quote join_path result to reflect ShellBase join_path (#45944) 2018-09-21 15:31:12 +10:00
strategy If including a file resulted in AnsibleFileNotFound, clarify error message. Fixes #45661 (#45667) 2018-09-18 09:04:33 -05:00
terminal Additional feature enhancements to nxos_logging (#45844) 2018-09-25 11:02:09 +05:30
test Added an async 'started' test (like 'finished') (#43445) 2018-08-24 01:29:34 +02:00
vars Allow loading dirs from role defaults/vars (#36357) 2018-04-10 17:14:38 -04:00
__init__.py inventory plugins: add test about config API usage (#41888) 2018-07-19 10:45:45 -07:00
loader.py pylint plugin to catch due/past-due deprecated calls (#44143) 2018-09-25 10:31:41 -05:00