operator-sdk-ansible-util
operator-sdk-ansible-util copied to clipboard
Use parameter for involved_obj["apiVersion"]
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 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.