Failed to initialize the Unity driver because it cannot connect to the Unity system.
Env:
- OpenStack version: Stein
- storops version: 0.5.12
- requests version: 2.20.0
storops uses `requests` to send rest to the Unity system. `requests` handles the possible redirect if needed.
The connection to the Unity system could be redirected to the CAS if not authorized. But due to a bug `requests` drops the auth in the headers.
Detail description about this issue:
https://github.com/requests/requests/commit/ea9436a5d6a5934a906e91202349aabf9af75d15
https://github.com/requests/requests/pull/4851
And the symptom you would see about this issue is like:
>>> u = storops.UnitySystem('10.245.101.39', 'admin', 'xxxxxxxx')
>>> u.info
REQ URL: [GET] https://10.245.101.39:443/api/types/basicSystemInfo?compact=True&fields=attributes.description,attributes.displayValue,attributes.initialValue,attributes.name,attributes.type,description,documentation,name,type
/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
REQ URL: [GET] https://10.245.101.39:443/api/types/basicSystemInfo?compact=True&fields=attributes.description,attributes.displayValue,attributes.initialValue,attributes.name,attributes.type,description,documentation,name,type, TIME: 0.143758058548, RESP CODE: 401
RESP BODY:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Unisphere</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="/cas/css/emc_cas.css;jsessionid=81AAB066EE1E0ECE67838E914BAC9EDA" />
<script type="text/javascript" src="js/common_rosters.js"></script>
<link rel="icon" href="/cas/favicon.ico" type="image/x-icon" />
<style>
#bg img{
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
z-index:-1;
}
</style>
</head>
<body id="cas" onload="init();">
<div id="msg" class="errors">
<h2>401 Unauthorized</h2>
<p>You are not authorized to view this page.</p>
</div>
</body>
</html>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sam/storops/storops/lib/common.py", line 54, in __repr__
return self.json(indent=4)
File "/home/sam/storops/storops/lib/common.py", line 51, in json
return json.dumps(self.get_dict_repr(), indent=indent, sort_keys=True)
File "/home/sam/storops/storops/lib/common.py", line 46, in get_dict_repr
props = self._get_properties(dec)
File "/home/sam/storops/storops/unity/resource/__init__.py", line 125, in _get_properties
props = super(UnityResource, self)._get_properties(dec)
File "/home/sam/storops/storops/lib/resource.py", line 147, in _get_properties
value = getattr(self, name)
File "/home/sam/storops/storops/lib/resource.py", line 172, in __getattr__
ret = self._get_property_from_raw(item)
File "/home/sam/storops/storops/unity/resource/__init__.py", line 143, in _get_property_from_raw
value = super(UnityResource, self)._get_property_from_raw(item)
File "/home/sam/storops/storops/lib/resource.py", line 186, in _get_property_from_raw
self.update()
File "/usr/local/lib/python2.7/dist-packages/cachez.py", line 206, in func_wrapper
return func(*args, **kwargs)
File "/home/sam/storops/storops/lib/resource.py", line 61, in update
data = self._get_raw_resource()
File "/home/sam/storops/storops/unity/resource/__init__.py", line 93, in _get_raw_resource
nested_fields=nested_fields)
File "/home/sam/storops/storops/unity/client.py", line 42, in _wrap
ret = func(*args, **kwargs)
File "/home/sam/storops/storops/unity/client.py", line 178, in get
base_fields = self.get_fields(type_name, base_fields, nested_fields)
File "/home/sam/storops/storops/unity/client.py", line 158, in get_fields
ret = unity_type.fields
File "/home/sam/storops/storops/unity/resource/type_resource.py", line 54, in fields
ret = tuple(sorted(att['name'] for att in self.attributes))
File "/home/sam/storops/storops/lib/resource.py", line 172, in __getattr__
ret = self._get_property_from_raw(item)
File "/home/sam/storops/storops/unity/resource/__init__.py", line 143, in _get_property_from_raw
value = super(UnityResource, self)._get_property_from_raw(item)
File "/home/sam/storops/storops/lib/resource.py", line 186, in _get_property_from_raw
self.update()
File "/usr/local/lib/python2.7/dist-packages/cachez.py", line 206, in func_wrapper
return func(*args, **kwargs)
File "/home/sam/storops/storops/lib/resource.py", line 61, in update
data = self._get_raw_resource()
File "/home/sam/storops/storops/unity/resource/type_resource.py", line 39, in _get_raw_resource
resp = self._cli.rest_get(url, fields=self._fields)
File "/home/sam/storops/storops/unity/client.py", line 124, in rest_get
return RestResponse(self._rest.get(url))
File "/home/sam/storops/storops/connection/connector.py", line 75, in get
return self.http_client.get(url, **kwargs)
File "/home/sam/storops/storops/connection/client.py", line 134, in get
result = self._cs_request(url, 'GET', **kwargs)
File "/home/sam/storops/storops/connection/client.py", line 122, in _cs_request
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/retryz/__init__.py", line 192, in func_wrapper
ret = function(*args, **kwargs)
File "/home/sam/storops/storops/connection/client.py", line 130, in _cs_request_with_retries
return self.request(url, method, **kwargs)
File "/home/sam/storops/storops/connection/client.py", line 114, in request
raise exceptions.from_response(resp, method, full_url)
storops.connection.exceptions.HTTPClientError: HTTP Client Error (HTTP 401)
can we pin 'requests!=2.20.0' in requirements/ upper-constrain ts.txt