Raise right exception in case Kubernetes respond with not found
When Kubernetes respond with not found to an API call of deletion,
we should raise a K8sResourceNotFound exception, right now we are
raising K8sClientException.
Closes-Bug:
@@ -182,6 +182,9 @@ class K8sClient(object):
verify=self.verify_server, headers=header)
if response.ok:
return response.json()
+ else:
+ if response.status_code == requests.codes.not_found:
+ raise exc.K8sResourceNotFound(response.text)
raise exc.K8sClientException(response)
def annotate(self, path, annotations, resource_version=None):
