refactor(services-restart): its shapes live in its own module, within the quality ratchet
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m26s
driver / test (3.12) (pull_request) Successful in 1m30s
driver / lowest (pull_request) Successful in 46s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m56s
driver / publish (pull_request) Skipped

models.py had grown past its recorded size; ServicesRestartDict and
RestartProcessDict move to services_restart, exported from the package.
This commit is contained in:
christianmanivong committed 2026-11-26 19:06:23 +01:00
1 parent 5517464e1f
commit 494b9ed046
4 files changed
+28 -24

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ recorded here; their history is the git log.
no report and raises, never a clean reading. A driver supplies
`_run_services_restart_command(command)`.
- `parse_services_restart`, `SERVICES_RESTART_COMMAND`, `DELETED_CODE_PATTERN`, and the
`ServicesRestartDict` and `RestartProcessDict` shapes.
`ServicesRestartDict` and `RestartProcessDict` shapes (in `services_restart`).
## [4.43.0] - 2026-11-26
+4
View File
@@ -303,6 +303,8 @@ from napalm_device_types.service_packages import (
from napalm_device_types.services import ServiceControlMixin
from napalm_device_types.services_restart import (
SERVICES_RESTART_COMMAND,
RestartProcessDict,
ServicesRestartDict,
ServicesRestartMixin,
parse_services_restart,
)
@@ -524,6 +526,8 @@ __all__ = [
"SERVICE_PACKAGES_COMMAND",
"SERVICES_RESTART_COMMAND",
"ServicesRestartMixin",
"ServicesRestartDict",
"RestartProcessDict",
"parse_services_restart",
"ServicePackagesMixin",
"parse_service_packages",
-21
View File
@@ -406,27 +406,6 @@ class ListeningSocketsDict(TypedDict):
sockets: list[ListeningSocketDict]
class RestartProcessDict(TypedDict):
"""A process that runs replaced code and belongs to no systemd service."""
pid: int
name: str # /proc/<pid>/comm
class ServicesRestartDict(TypedDict):
"""What ``ServicesRestartMixin.get_services_need_restart`` read.
``units`` are the systemd services, without ".service", that still run code
an update replaced on disk; empty when none does. ``processes`` are the ones
that belong to no service (a login session, systemd itself), read only by the
``/proc`` scan; the host's own tools name services only.
"""
source: str # "needs-restarting", "needrestart" or "maps"
units: list[str]
processes: list[RestartProcessDict]
class NetfilterMatchDict(TypedDict):
"""One condition of a netfilter rule.
+23 -2
View File
@@ -38,12 +38,33 @@ from __future__ import annotations
import re
from shlex import quote
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, TypedDict
from napalm_device_types.listening import _cgroup_paths, _container, _unit
from napalm_device_types.models import RestartProcessDict, ServicesRestartDict
from napalm_device_types.terminal import strip_terminal_codes
class RestartProcessDict(TypedDict):
"""A process that runs replaced code and belongs to no systemd service."""
pid: int
name: str # /proc/<pid>/comm
class ServicesRestartDict(TypedDict):
"""What :meth:`ServicesRestartMixin.get_services_need_restart` read.
``units`` are the systemd services, without ".service", that still run code
an update replaced on disk; empty when none does. ``processes`` are the ones
that belong to no service (a login session, systemd itself), read only by the
``/proc`` scan; the host's own tools name services only.
"""
source: str # "needs-restarting", "needrestart" or "maps"
units: list[str]
processes: list[RestartProcessDict]
_BEGIN = "RST_BEGIN"
_END = "RST_END"
NEEDS_RESTARTING = "needs-restarting"