mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-23 11:22:21 +03:00
refactor: fix lint issues
This commit is contained in:
parent
68b5e89bfa
commit
569b46d272
@ -618,7 +618,7 @@ class QemuVM(KernelDatapathMixin, BaseNode):
|
|||||||
else:
|
else:
|
||||||
await command(f"eject -f {device}")
|
await command(f"eject -f {device}")
|
||||||
log.debug('QEMU VM "%s" has changed %s to %s', self._name, name, image)
|
log.debug('QEMU VM "%s" has changed %s to %s', self._name, name, image)
|
||||||
except (asyncio.TimeoutError, asyncio.IncompleteReadError, OSError) as e:
|
except (TimeoutError, asyncio.IncompleteReadError, OSError) as e:
|
||||||
raise QemuError(f"Could not change CD/DVD media: {e}") from e
|
raise QemuError(f"Could not change CD/DVD media: {e}") from e
|
||||||
finally:
|
finally:
|
||||||
writer.close()
|
writer.close()
|
||||||
|
|||||||
@ -363,7 +363,7 @@ async def _probe_bridge_tap(path, config, timeout): # noqa: ASYNC109 - operatio
|
|||||||
shutil.rmtree(working_dir, ignore_errors=True)
|
shutil.rmtree(working_dir, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
async def probe_vxlan_support(timeout: float = 15.0):
|
async def probe_vxlan_support(timeout: float = 15.0): # noqa: ASYNC109 - operation-specific timeout is intentional
|
||||||
"""
|
"""
|
||||||
Whether this host's uBridge can create a VXLAN device (the ``vxlan``
|
Whether this host's uBridge can create a VXLAN device (the ``vxlan``
|
||||||
module) — the carrier a cross-compute kernel link tunnels through.
|
module) — the carrier a cross-compute kernel link tunnels through.
|
||||||
@ -395,7 +395,7 @@ async def probe_vxlan_support(timeout: float = 15.0):
|
|||||||
return supported
|
return supported
|
||||||
|
|
||||||
|
|
||||||
async def _probe_vxlan(path, config, timeout):
|
async def _probe_vxlan(path, config, timeout): # noqa: ASYNC109 - operation-specific timeout is intentional
|
||||||
"""
|
"""
|
||||||
Spawn a throwaway uBridge and run one ``vxlan create``/``delete`` cycle.
|
Spawn a throwaway uBridge and run one ``vxlan create``/``delete`` cycle.
|
||||||
The scratch name (uuid suffix) cannot collide with a real link's
|
The scratch name (uuid suffix) cannot collide with a real link's
|
||||||
@ -442,7 +442,7 @@ async def _probe_vxlan(path, config, timeout):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
return await asyncio.wait_for(ask(), timeout=timeout)
|
return await asyncio.wait_for(ask(), timeout=timeout)
|
||||||
except (UbridgeError, OSError, asyncio.TimeoutError, ValueError) as e:
|
except (TimeoutError, UbridgeError, OSError, ValueError) as e:
|
||||||
# Old build ("Unknown command"), missing module, or no
|
# Old build ("Unknown command"), missing module, or no
|
||||||
# CAP_NET_ADMIN: unknown.
|
# CAP_NET_ADMIN: unknown.
|
||||||
log.debug("uBridge vxlan-module probe failed: %s", e)
|
log.debug("uBridge vxlan-module probe failed: %s", e)
|
||||||
|
|||||||
@ -976,7 +976,7 @@ class Node:
|
|||||||
try:
|
try:
|
||||||
await self._start_on_compute(data)
|
await self._start_on_compute(data)
|
||||||
break
|
break
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
raise ControllerTimeoutError(f"Timeout when starting {self._name}")
|
raise ControllerTimeoutError(f"Timeout when starting {self._name}")
|
||||||
except ComputeError as e:
|
except ComputeError as e:
|
||||||
conflicted = self._vxlan_conflicted_link(e)
|
conflicted = self._vxlan_conflicted_link(e)
|
||||||
|
|||||||
@ -331,7 +331,7 @@ class RbacRepository(BaseRepository):
|
|||||||
Retrieve all user ACEs matching the user_id and privilege name.
|
Retrieve all user ACEs matching the user_id and privilege name.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
query: Select[tuple[Any, Any, Any, Any]] = (
|
query: Select[Any, Any, Any, Any] = (
|
||||||
select(models.ACE.path, models.ACE.propagate, models.ACE.allowed, models.Privilege.name)
|
select(models.ACE.path, models.ACE.propagate, models.ACE.allowed, models.Privilege.name)
|
||||||
.join(models.Privilege.roles)
|
.join(models.Privilege.roles)
|
||||||
.join(models.Role.acl_entries)
|
.join(models.Role.acl_entries)
|
||||||
@ -349,7 +349,7 @@ class RbacRepository(BaseRepository):
|
|||||||
Retrieve all group ACEs matching the user_id and privilege name.
|
Retrieve all group ACEs matching the user_id and privilege name.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
query: Select[tuple[Any, Any, Any, Any]] = (
|
query: Select[Any, Any, Any, Any] = (
|
||||||
select(models.ACE.path, models.ACE.propagate, models.ACE.allowed, models.Privilege.name)
|
select(models.ACE.path, models.ACE.propagate, models.ACE.allowed, models.Privilege.name)
|
||||||
.join(models.Privilege.roles)
|
.join(models.Privilege.roles)
|
||||||
.join(models.Role.acl_entries)
|
.join(models.Role.acl_entries)
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from enum import Enum
|
from enum import StrEnum
|
||||||
from typing import List, Optional, Union
|
from typing import List, Optional, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from enum import Enum
|
from enum import StrEnum
|
||||||
from typing import List, Literal, Optional
|
from typing import List, Literal, Optional
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user