What
ArgoClient.get_workflow_templates is a generator that returns None on a 404 from the list call:
except client.rest.ApiException as e:
...
if e.status == 404:
return None
Because it's a generator, return None simply stops iteration — the value never reaches the caller and no exception is raised. list(client.get_workflow_templates()) therefore yields [], indistinguishable from a successful-but-empty list.
Why it's a problem
A 404 on list_namespaced_custom_object for workflowtemplates means the namespace or the CRD isn't present (or a misconfigured path) — not "zero templates," which is a 200 with items: []. So callers can't tell an enumeration failure from an empty cluster. For any reconciling or destructive use (e.g. tearing down templates), the failure reads silently as "nothing to do."
For contrast, within this same file: the other list-path statuses already raise (the non-Expired 410 falls through to raise ArgoClientException), and the singular getters returning None on 404 is fine — there a 404 genuinely means "that named object is absent." It's specifically the list generator where empty-on-404 loses information.
Suggested fix
Raise on the list 404, as the other statuses do, instead of return None:
if e.status == 404:
raise ArgoClientException(error_message)
(or a typed ArgoResourceNotFound via wrap_api_error, if preferred). This keeps "no templates" as [] and surfaces a real listing failure.
Reproduced on master (linked file). Happy to send a PR if the direction looks right.
What
ArgoClient.get_workflow_templatesis a generator that returnsNoneon a 404 from the list call:Because it's a generator,
return Nonesimply stops iteration — the value never reaches the caller and no exception is raised.list(client.get_workflow_templates())therefore yields[], indistinguishable from a successful-but-empty list.Why it's a problem
A 404 on
list_namespaced_custom_objectforworkflowtemplatesmeans the namespace or the CRD isn't present (or a misconfigured path) — not "zero templates," which is a 200 withitems: []. So callers can't tell an enumeration failure from an empty cluster. For any reconciling or destructive use (e.g. tearing down templates), the failure reads silently as "nothing to do."For contrast, within this same file: the other list-path statuses already raise (the non-
Expired410 falls through toraise ArgoClientException), and the singular getters returningNoneon 404 is fine — there a 404 genuinely means "that named object is absent." It's specifically the list generator where empty-on-404 loses information.Suggested fix
Raise on the list 404, as the other statuses do, instead of
return None:(or a typed
ArgoResourceNotFoundviawrap_api_error, if preferred). This keeps "no templates" as[]and surfaces a real listing failure.Reproduced on
master(linked file). Happy to send a PR if the direction looks right.