mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-28 19:22:22 +02:00
Fix _fix_permissions error handling and list_node_files PermissionError
- _fix_permissions: capture stderr, check returncode, only set _permissions_fixed on success instead of silently marking as fixed - list_node_files: wrap os.scandir in try-except to handle PermissionError gracefully
This commit is contained in:
parent
e659b64bf0
commit
1a307edbca
@ -772,11 +772,19 @@ class DockerVM(BaseNode):
|
|||||||
' && /gns3/bin/busybox chown {uid}:{gid} -R "{path}"'.format(
|
' && /gns3/bin/busybox chown {uid}:{gid} -R "{path}"'.format(
|
||||||
uid=os.getuid(), gid=os.getgid(), path=volume
|
uid=os.getuid(), gid=os.getgid(), path=volume
|
||||||
),
|
),
|
||||||
|
stderr=asyncio.subprocess.PIPE,
|
||||||
)
|
)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise DockerError(f"Could not fix permissions for {volume}: {e}")
|
raise DockerError(f"Could not fix permissions for {volume}: {e}")
|
||||||
await process.wait()
|
await process.wait()
|
||||||
self._permissions_fixed = True
|
if process.returncode != 0:
|
||||||
|
stderr = (await process.stderr.read()).decode(errors="replace").strip()
|
||||||
|
log.error(
|
||||||
|
"Failed to fix permissions on '%s' for container '%s': %s",
|
||||||
|
volume, self._name, stderr or f"exit code {process.returncode}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self._permissions_fixed = True
|
||||||
|
|
||||||
async def _start_vnc_process(self, restart=False):
|
async def _start_vnc_process(self, restart=False):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user