sync
This commit is contained in:
@@ -11,14 +11,14 @@ TCo_NetABC = TypeVar("TCo_NetABC", bound=T_NetAbc, covariant=True)
|
|||||||
|
|
||||||
class ServiceYamlAbc[T_net: T_NetAbc](TypedDict):
|
class ServiceYamlAbc[T_net: T_NetAbc](TypedDict):
|
||||||
command: NotRequired[list[str]]
|
command: NotRequired[list[str]]
|
||||||
container_name: str
|
container_name: NotRequired[str]
|
||||||
entrypoint: list[str]
|
entrypoint: NotRequired[list[str]]
|
||||||
environment: NotRequired[dict[str, T_Primitive]]
|
environment: NotRequired[dict[str, T_Primitive]]
|
||||||
image: str
|
image: str
|
||||||
labels: NotRequired[list[str]]
|
labels: NotRequired[list[str]]
|
||||||
logging: dict[str, str]
|
logging: NotRequired[dict[str, str]]
|
||||||
networks: NotRequired[list[T_net]]
|
networks: NotRequired[list[T_net]]
|
||||||
restart: str
|
restart: NotRequired[str]
|
||||||
security_opt: NotRequired[list[str]]
|
security_opt: NotRequired[list[str]]
|
||||||
user: NotRequired[str]
|
user: NotRequired[str]
|
||||||
volumes: NotRequired[list[str]]
|
volumes: NotRequired[list[str]]
|
||||||
@@ -46,7 +46,7 @@ type T_Compose = ServiceYaml | TraefikServiceYaml
|
|||||||
class ServiceAbc[T_net: T_NetAbc, T_Yaml: T_Compose](metaclass=ABCMeta):
|
class ServiceAbc[T_net: T_NetAbc, T_Yaml: T_Compose](metaclass=ABCMeta):
|
||||||
command: tuple[str, ...] | None
|
command: tuple[str, ...] | None
|
||||||
container_name: str
|
container_name: str
|
||||||
entrypoint: tuple[str, ...]
|
entrypoint: tuple[str, ...] | None
|
||||||
environment: dict[str, T_Primitive] | None
|
environment: dict[str, T_Primitive] | None
|
||||||
image: str
|
image: str
|
||||||
labels: frozenset[str] | None
|
labels: frozenset[str] | None
|
||||||
@@ -61,10 +61,14 @@ class ServiceAbc[T_net: T_NetAbc, T_Yaml: T_Compose](metaclass=ABCMeta):
|
|||||||
def from_dict(cls, data: T_Yaml) -> Self:
|
def from_dict(cls, data: T_Yaml) -> Self:
|
||||||
command = data.get("command")
|
command = data.get("command")
|
||||||
volumes = data.get("volumes")
|
volumes = data.get("volumes")
|
||||||
|
entry = data.get("entrypoint")
|
||||||
|
name = data.get("container_name")
|
||||||
|
if name is None:
|
||||||
|
raise KeyError
|
||||||
return cls(
|
return cls(
|
||||||
tuple(command) if command else None,
|
tuple(command) if command else None,
|
||||||
data["container_name"],
|
name,
|
||||||
tuple(data["entrypoint"]),
|
tuple(entry) if entry else None,
|
||||||
data.get("environment"),
|
data.get("environment"),
|
||||||
data["image"],
|
data["image"],
|
||||||
_get_labels(data),
|
_get_labels(data),
|
||||||
|
|||||||
Reference in New Issue
Block a user