operator-sdk-ansible-util icon indicating copy to clipboard operation
operator-sdk-ansible-util copied to clipboard

Use parameter for involved_obj["apiVersion"]

Open MrBasset opened this issue 2 years ago • 1 comments
trafficstars

I noticed that the apiVersion for the involved object had been hard coded to v1; I found that for CR's where the ApiVersion was different I would get an error thrown on line 282 as 281 returned true but there was no .get attribute on the resource list.

My python skills aren't that great, so I'm not sure how 280 needs to be modified to fix the test though; testing the attribute exists seems a bit clunky though.

MrBasset avatar Feb 24 '23 20:02 MrBasset

@MrBasset actually involved_obj.get("apiVersion", "v1") means get involved_obj["apiVersion"] and fallback to "v1" if it's not defined. See the .get() function of python dicts.

I'm not part of the project but the original code looks ok to me.

piec avatar Oct 30 '23 23:10 piec