Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

raw: Handle exception raised by underlying APIs #180

Merged
merged 1 commit into from
Aug 11, 2020

Conversation

Akasurde
Copy link
Member

@Akasurde Akasurde commented Aug 4, 2020

SUMMARY

kind can be provided by number of ways. It is diffcult to
find all cases. So, handle exceptions raised by underlying
APIs and provide good error message to user.

Fixes: ansible/ansible#63652

Signed-off-by: Abhijeet Kasurde akasurde@redhat.com

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

plugins/module_utils/raw.py

kind can be provided by number of ways. It is diffcult to
find all cases. So, handle exceptions raised by underlying
APIs and provide good error message to user.

Fixes: ansible/ansible#63652

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@@ -175,7 +176,7 @@ def execute_module(self):
continue
kind = definition.get('kind', self.kind)
api_version = definition.get('apiVersion', self.api_version)
if kind.endswith('List'):
if kind and kind.endswith('List'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if kind isn't defined here we're broken anyway, this should have been validated earlier. We could add an additional failout here if either kind or api_version aren't defined

Copy link
Collaborator

@fabianvf fabianvf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit but not really important, lgtm

@tima
Copy link
Collaborator

tima commented Aug 7, 2020

@geerlingguy and @willthames -- any thoughts here?

@tima tima added has_issue This PR has a related issue it could close. type/bug Something isn't working labels Aug 7, 2020
@willthames
Copy link
Collaborator

Agree with @fabianvf's comments but this is a good change without those revisions, they would just improve it further (so not a blocker for me)

@Akasurde Akasurde merged commit 4f33ba7 into ansible-collections:main Aug 11, 2020
@Akasurde Akasurde deleted the main branch August 11, 2020 05:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has_issue This PR has a related issue it could close. type/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

k8s execute_module\nAttributeError: 'NoneType' object has no attribute 'endswith'\n"
4 participants