be more accurate when checking if cosmos enabled (#555)
This commit is contained in:
@@ -37,10 +37,14 @@ class Cosmos():
|
||||
# authorized for the command specified, not this endpoint
|
||||
except DCOSAuthorizationException:
|
||||
return True
|
||||
# all other errors are treated as endpoint not available
|
||||
# allow exception through so we can show user actual http exception
|
||||
# except 404, because then the url is fine, just not cosmos enabled
|
||||
except DCOSHTTPException as e:
|
||||
logger.exception(e)
|
||||
return e.status() != 404
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
return False
|
||||
return True
|
||||
|
||||
return response.status_code == 200
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ class DCOSHTTPException(DCOSException):
|
||||
def __init__(self, response):
|
||||
self.response = response
|
||||
|
||||
def status(self):
|
||||
return self.response.status_code
|
||||
|
||||
def __str__(self):
|
||||
return 'Error while fetching [{0}]: HTTP {1}: {2}'.format(
|
||||
self.response.request.url,
|
||||
|
||||
Reference in New Issue
Block a user