Generally agree with rharper that the code is duplicate.
lets just put it in a single function?
def should_retry_on_url_exc(exc):
if not isinstance(exc, UrlError):
return False
if exc.code == url_helper.NOT_FOUND
return True
if exc.cause and isinstance(exc.cause, requests.Timeout):
return True
Also using 'exc' in that function compared to 'exception' means we
dont have sunc long lines.
i only looked at it here though, so maybe i missed some context that
i should have seen if i'd have branched and looked in the full file.
scott
--
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/358112
Your team cloud-init commiters is requested to review the proposed merge of
~chad.smith/cloud-init:bug/1800223-retry-imds-on-timeout into cloud-init:master.
_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help : https://help.launchpad.net/ListHelp