DataSourceEc2: Fix incorrect return in _get_url_settings
get_url_settings should return a pair of max wait and timeout and not false, fix this bug by checking the max_wait <= 0 in the calling function and returning correctly from there instead.
This commit is contained in:
commit
0083f2d5d0
@ -92,12 +92,9 @@ class DataSourceEc2(sources.DataSource):
|
|||||||
except Exception:
|
except Exception:
|
||||||
util.logexc(LOG, "Failed to get max wait. using %s", max_wait)
|
util.logexc(LOG, "Failed to get max wait. using %s", max_wait)
|
||||||
|
|
||||||
if max_wait == 0:
|
|
||||||
return False
|
|
||||||
|
|
||||||
timeout = 50
|
timeout = 50
|
||||||
try:
|
try:
|
||||||
timeout = int(mcfg.get("timeout", timeout))
|
timeout = max(0, int(mcfg.get("timeout", timeout)))
|
||||||
except Exception:
|
except Exception:
|
||||||
util.logexc(LOG, "Failed to get timeout, using %s", timeout)
|
util.logexc(LOG, "Failed to get timeout, using %s", timeout)
|
||||||
|
|
||||||
@ -109,6 +106,8 @@ class DataSourceEc2(sources.DataSource):
|
|||||||
mcfg = {}
|
mcfg = {}
|
||||||
|
|
||||||
(max_wait, timeout) = self._get_url_settings()
|
(max_wait, timeout) = self._get_url_settings()
|
||||||
|
if max_wait <= 0:
|
||||||
|
return False
|
||||||
|
|
||||||
# Remove addresses from the list that wont resolve.
|
# Remove addresses from the list that wont resolve.
|
||||||
mdurls = mcfg.get("metadata_urls", DEF_MD_URLS)
|
mdurls = mcfg.get("metadata_urls", DEF_MD_URLS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user