First, if http is not configured to redirect, then using the raw IP or fqdn for OneFS will result in an ApiException with Traceback:
Traceback (most recent call last):
...
check_inheritance(isi_sdk.AuthApi(onefs).get_settings_acls())
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0_1/apis/auth_api.py", line 4444, in get_settings_acls
callback=params.get('callback'))
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0_1/api_client.py", line 339, in call_api
response_type, auth_settings, callback)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0_1/api_client.py", line 166, in __call_api
post_params=post_params, body=body)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0_1/api_client.py", line 359, in request
headers=headers)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0_1/rest.py", line 184, in GET
query_params=query_params)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0_1/rest.py", line 177, in request
raise ApiException(http_resp=r)
isi_sdk_8_0_1.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 18 May 2017 16:38:01 GMT', 'Content-Length': '227', 'Content-Type': 'text/html; charset=iso-8859-1', 'Server': 'Apache/2.2.31 (FreeBSD) DAV/2 mod_ssl/2.2.31 OpenSSL/1.0.2j-fips'})
HTTP response body: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /platform/3/auth/settings/acls was not found on this server.</p>
</body></html>
Instead of this traceback the user should get an error that the request was rejected and they should try HTTPS if they haven't already.
Missing port
Second, if the host string has https:// but not the port :8080 at the end of the IP or fqdn, an exception is raised by urllib3:
2017-05-19 09:09:53,611 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x344c5d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /platform/3/auth/settings/acls
[2017-05-19 09:09:53,611] WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x344c5d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /platform/3/auth/settings/acls
2017-05-19 09:09:53,857 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x344c790>: Failed to establish a new connection: [Errno 111] Connection refused',)': /platform/3/auth/settings/acls
[2017-05-19 09:09:53,857] WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x344c790>: Failed to establish a new connection: [Errno 111] Connection refused',)': /platform/3/auth/settings/acls
2017-05-19 09:09:54,099 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x344c8d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /platform/3/auth/settings/acls
[2017-05-19 09:09:54,099] WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x344c8d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /platform/3/auth/settings/acls
Traceback (most recent call last):
File "isilon-hadoop-tools/ambari_config_check.py", line 542, in <module>
main()
File "isilon-hadoop-tools/ambari_config_check.py", line 489, in main
check_inheritance(isi_sdk.AuthApi(onefs).get_settings_acls())
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0/apis/auth_api.py", line 4210, in get_settings_acls
callback=params.get('callback'))
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0/api_client.py", line 339, in call_api
response_type, auth_settings, callback)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0/api_client.py", line 166, in __call_api
post_params=post_params, body=body)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0/api_client.py", line 359, in request
headers=headers)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0/rest.py", line 184, in GET
query_params=query_params)
File "/usr/lib/python2.7/site-packages/isi_sdk_8_0/rest.py", line 161, in request
headers=headers)
File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 66, in request
**urlopen_kw)
File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 87, in request_encode_url
return self.urlopen(method, url, **extra_kw)
File "/usr/lib/python2.7/site-packages/urllib3/poolmanager.py", line 321, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 678, in urlopen
**response_kw)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 678, in urlopen
**response_kw)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 678, in urlopen
**response_kw)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python2.7/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='dog-pools.west.isilon.com', port=443): Max retries exceeded with url: /platform/3/auth/settings/acls (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x344c9d0>: Failed to establish a new connection: [Errno 111] Connection refused',))
This error is not helpful since it's not clear how urllib3 got the string that it tried to use. It would be easy to check the host to see if it has https:// at the front and no port, and warn the user.
The python bindings should catch two errors.
HTTP not redirected
First, if http is not configured to
redirect
, then using the raw IP or fqdn for OneFS will result in an ApiException with Traceback:Instead of this traceback the user should get an error that the request was rejected and they should try HTTPS if they haven't already.
Missing port
Second, if the host string has
https://
but not the port:8080
at the end of the IP or fqdn, an exception is raised by urllib3:This error is not helpful since it's not clear how urllib3 got the string that it tried to use. It would be easy to check the host to see if it has https:// at the front and no port, and warn the user.