alibaba / alibaba/acm-sdk-python
不设置环境变量DIAMOND_SERVER_IPS导致异常exception 'NoneType' object has no attribute 'split' occur
- Dominant language
- Python
- Stars
- 59
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
ERROR:root:[get-config] exception 'NoneType' object has no attribute 'split' occur
Traceback (most recent call last):
File "/Users/alsc/work/.pyodps/lib/python3.9/site-packages/acm/client.py", line 439, in get_raw
resp = self._do_sync_req("/diamond-server/config.co", None, params, None, timeout or self.default_timeout)
File "/Users/alsc/work/.pyodps/lib/python3.9/site-packages/acm/client.py", line 663, in _do_sync_req
server_info = self.get_server()
File "/Users/alsc/work/.pyodps/lib/python3.9/site-packages/acm/client.py", line 284, in get_server
server_list = get_server_list(self.endpoint, 443 if self.tls_enabled else 8080, self.cai_enabled,
File "/Users/alsc/work/.pyodps/lib/python3.9/site-packages/acm/server.py", line 43, in get_server_list
for server_addr in server_addresses.split(","):
AttributeError: 'NoneType' object has no attribute 'split'
有些环境下,不需要设置DIAMOND_SERVER_IPS,但目前版本,必须设置,否则会抛异常中断后续流程,获取不到data;
建议加个server_addresses的NoneType判断,再进行server_addresses.split(",")
def get_server_list(endpoint, default_port=8080, cai_enabled=True, unit_name=None):
server_list = list()
import os
server_addresses = os.getenv('DIAMOND_SERVER_IPS')
for server_addr in server_addresses.split(","):
if server_addr is not "" and parse_nacos_server_addr(server_addr):
server_list.append(parse_nacos_server_addr(server_addr.strip()))
if len(server_list) > 0:
return server_list
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in acm/server.py at get_server_list, using the traceback and the DIAMOND_SERVER_IPS lookup as the entry point. Check the behavior when the environment variable is unset, then verify that server discovery no longer raises the reported AttributeError and that configured addresses still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100