kragniz / kragniz/python-etcd3

Channel error when missing cert

Open
#1,002 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
450
Forks
194
PR merge metrics
No merged PRs in 30d

Description

I believe we should not try to close the channel if the certificate wasn't found:

```
[Errno 2] No such file or directory: 'cert_key'
Traceback (most recent call last):
File "./bin/../scripts/uncloud", line 88, in
main(arguments)
File "/home/nico/vcs/uncloud/uncloud/hack/main.py", line 17, in main
vm = VM(config)
File "/home/nico/vcs/uncloud/uncloud/hack/vm.py", line 32, in __init__
self.db = DB(config)
File "/home/nico/vcs/uncloud/uncloud/hack/db.py", line 30, in __init__
self.connect()
File "/home/nico/vcs/uncloud/uncloud/hack/db.py", line 35, in connect
client = etcd3.client(*self.config.etcd_args)
File "/home/nico/vcs/uncloud/venv/lib/python3.8/site-packages/etcd3-0.11.1-py3.8.egg/etcd3/client.py", line 1180, in client
return Etcd3Client(host=host,
File "/home/nico/vcs/uncloud/venv/lib/python3.8/site-packages/etcd3-0.11.1-py3.8.egg/etcd3/client.py", line 113, in __init__
credentials = self._get_secure_creds(
File "/home/nico/vcs/uncloud/venv/lib/python3.8/site-packages/etcd3-0.11.1-py3.8.egg/etcd3/client.py", line 188, in _get_secure_creds
with open(ca_cert, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'cert_key'
Exception ignored in:
Traceback (most recent call last):
File "/home/nico/vcs/uncloud/venv/lib/python3.8/site-packages/etcd3-0.11.1-py3.8.egg/etcd3/client.py", line 182, in __del__
self.close()
File "/home/nico/vcs/uncloud/venv/lib/python3.8/site-packages/etcd3-0.11.1-py3.8.egg/etcd3/client.py", line 173, in close
self.channel.close()
AttributeError: 'Etcd3Client' object has no attribute 'channel'
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the missing-certificate failure through scripts/uncloud and inspect uncloud/hack/db.py, then trace the etcd3 client initialization shown in the traceback. Confirm the cleanup path when certificate loading fails and verify that the channel is not closed before it exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.