diff --git a/juju/client/proxy/kubernetes/proxy.py b/juju/client/proxy/kubernetes/proxy.py index fabb01e65..3eb53c5c0 100644 --- a/juju/client/proxy/kubernetes/proxy.py +++ b/juju/client/proxy/kubernetes/proxy.py @@ -2,11 +2,14 @@ # Licensed under the Apache V2, see LICENCE file for details. import os import tempfile +import logging from juju.client.proxy.proxy import Proxy, ProxyNotConnectedError from kubernetes import client from kubernetes.stream import portforward +log = logging.getLogger('juju.client.connection') + class KubernetesProxy(Proxy): def __init__( @@ -60,7 +63,10 @@ def connect(self): def __del__(self): self.close() - os.unlink(self.temp_ca_file.name) + try: + os.unlink(self.temp_ca_file.name) + except FileNotFoundError: + log.debug(f"file {self.temp_ca_file.name} not found") def close(self): try: