Feilong is a open source z/VM cloud connector project under the Open Mainframe Project umbrella that will accelerate the z/VM adoption, extending its ecosystem and its user experience. It provides a set of APIs to operate z/VM including guest, image, network, volume etc.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/zVMCloudConnector-1.6.6-py3.10.egg/zvmsdk/sdkwsgi/requestlog.py", line 45, in __call__
return self._log_and_call(environ, start_response)
File "/usr/local/lib/python3.10/dist-packages/zVMCloudConnector-1.6.6-py3.10.egg/zvmsdk/sdkwsgi/requestlog.py", line 64, in _log_and_call
return self.application(environ, _local_response)
File "/usr/local/lib/python3.10/dist-packages/WebOb-1.8.7-py3.10.egg/webob/dec.py", line 143, in __call__
return resp(environ, start_response)
File "/usr/local/lib/python3.10/dist-packages/WebOb-1.8.7-py3.10.egg/webob/response.py", line 1312, in __call__
start_response(self.status, headerlist)
File "/usr/local/lib/python3.10/dist-packages/zVMCloudConnector-1.6.6-py3.10.egg/zvmsdk/sdkwsgi/requestlog.py", line 57, in _local_response
headers[index] = ('X-Auth-Token', value[1].decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
Removing the .decode('utf-8') in zvmsdk/sdkwsgi/requestlog.py resolves the issue.
This was introduced by this commit:
commit be8a31a9fa6535cceb11c34d9b739bbdab23e54e
Author: SharpRazor <bjcb@cn.ibm.com>
Date: Fri Jul 10 10:09:41 2020 +0800
type error reported when sending requests to WSGI in zcc
this is because the data type of X-Auth-Token in headers is bytes
but start_response expect unicode type.
so change the type hardly, still need finding the root cause.
Signed-off-by: SharpRazor <bjcb@cn.ibm.com>
diff --git a/zvmsdk/sdkwsgi/requestlog.py b/zvmsdk/sdkwsgi/requestlog.py
index 0107380e..a8db025d 100644
--- a/zvmsdk/sdkwsgi/requestlog.py
+++ b/zvmsdk/sdkwsgi/requestlog.py
@@ -49,6 +49,10 @@ class RequestLog(object):
for name, value in headers:
if name.lower() == 'content-length':
size = value
+ for index, value in enumerate(headers):
+ if value[0] == 'X-Auth-Token':
+ headers[index] = ('X-Auth-Token', value[1].decode('utf-8'))
+ break
self._write_log(environ, req_uri, status, size, headers,
exc_info)
When trying to create an authentication token:
a "502 bad gateway" is returned:
Log file
/var/log/nginx/error.log
containsLog file
/var/log/zvmsdk/uwsgi.log
contains:Removing the
.decode('utf-8')
inzvmsdk/sdkwsgi/requestlog.py
resolves the issue.This was introduced by this commit: