Skip to content

Commit 7002122

Browse files
committed
Handle error in Kubernetes proxy __del__
1 parent e017bd2 commit 7002122

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

juju/client/proxy/kubernetes/proxy.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
# Licensed under the Apache V2, see LICENCE file for details.
33
import os
44
import tempfile
5+
import logging
56

67
from juju.client.proxy.proxy import Proxy, ProxyNotConnectedError
78
from kubernetes import client
89
from kubernetes.stream import portforward
910

11+
log = logging.getLogger('juju.client.connection')
12+
1013

1114
class KubernetesProxy(Proxy):
1215
def __init__(
@@ -60,7 +63,10 @@ def connect(self):
6063

6164
def __del__(self):
6265
self.close()
63-
os.unlink(self.temp_ca_file.name)
66+
try:
67+
os.unlink(self.temp_ca_file.name)
68+
except FileNotFoundError:
69+
log.debug(f"file {self.temp_ca_file.name} not found")
6470

6571
def close(self):
6672
try:

0 commit comments

Comments
 (0)