mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
refactor: use explicit conversion in f-strings
This commit is contained in:
32 files changed
+65
-65
No files matched your search
@@ -1468,7 +1468,7 @@ class DockerVM(BaseNode):
|
||||
pass
|
||||
# Ignore runtime error because when closing the server
|
||||
except RuntimeError as e:
|
||||
log.debug(f"Docker runtime error when closing: {str(e)}")
|
||||
log.debug(f"Docker runtime error when closing: {e!s}")
|
||||
return
|
||||
self.status = "stopped"
|
||||
|
||||
@@ -1571,7 +1571,7 @@ class DockerVM(BaseNode):
|
||||
self.manager.port_manager.release_udp_port(nio.lport, self._project)
|
||||
# Ignore runtime error because when closing the server
|
||||
except (DockerHttp404Error, RuntimeError) as e:
|
||||
log.debug(f"Docker error when closing: {str(e)}")
|
||||
log.debug(f"Docker error when closing: {e!s}")
|
||||
return
|
||||
|
||||
def _get_container_ifname(self, adapter_number):
|
||||
@@ -1775,7 +1775,7 @@ class DockerVM(BaseNode):
|
||||
|
||||
for index in range(4096):
|
||||
if f"tap-gns3-e{index}" not in psutil.net_if_addrs():
|
||||
adapter.host_ifc = f"tap-gns3-e{str(index)}"
|
||||
adapter.host_ifc = f"tap-gns3-e{index!s}"
|
||||
break
|
||||
if adapter.host_ifc is None:
|
||||
raise DockerError(
|
||||
|
||||
@@ -97,7 +97,7 @@ class Router(BaseNode):
|
||||
try:
|
||||
os.makedirs(os.path.join(self._working_directory, "configs"), exist_ok=True)
|
||||
except OSError as e:
|
||||
raise DynamipsError(f"Can't create the dynamips config directory: {str(e)}")
|
||||
raise DynamipsError(f"Can't create the dynamips config directory: {e!s}")
|
||||
if dynamips_id:
|
||||
self._convert_before_2_0_0_b3(dynamips_id)
|
||||
|
||||
@@ -153,7 +153,7 @@ class Router(BaseNode):
|
||||
try:
|
||||
shutil.move(path, dst)
|
||||
except OSError as e:
|
||||
log.error(f"Can't move {path}: {str(e)}")
|
||||
log.error(f"Can't move {path}: {e!s}")
|
||||
continue
|
||||
for path in glob.glob(os.path.join(glob.escape(dynamips_dir), f"*_i{dynamips_id}_*")):
|
||||
dst = os.path.join(self._working_directory, os.path.basename(path))
|
||||
@@ -161,7 +161,7 @@ class Router(BaseNode):
|
||||
try:
|
||||
shutil.move(path, dst)
|
||||
except OSError as e:
|
||||
log.error(f"Can't move {path}: {str(e)}")
|
||||
log.error(f"Can't move {path}: {e!s}")
|
||||
continue
|
||||
|
||||
def asdict(self):
|
||||
@@ -1608,7 +1608,7 @@ class Router(BaseNode):
|
||||
try:
|
||||
open(output_file, "w+").close()
|
||||
except OSError as e:
|
||||
raise DynamipsError(f'Can not write capture to "{output_file}": {str(e)}')
|
||||
raise DynamipsError(f'Can not write capture to "{output_file}": {e!s}')
|
||||
|
||||
try:
|
||||
adapter = self._slots[slot_number]
|
||||
|
||||
Reference in new issue
Block a user