feat: add smolmachines/egress_apply proxying docker backend
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
"""Egress apply for the smolmachines backend.
|
||||||
|
|
||||||
|
The smolmachines sidecar bundle runs as a host-side Docker container,
|
||||||
|
so egress signalling is identical to the docker backend.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from ..docker.egress_apply import ( # noqa: F401
|
||||||
|
EgressApplyError,
|
||||||
|
apply_routes_change,
|
||||||
|
fetch_current_routes,
|
||||||
|
validate_routes_content,
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"EgressApplyError",
|
||||||
|
"apply_routes_change",
|
||||||
|
"fetch_current_routes",
|
||||||
|
"validate_routes_content",
|
||||||
|
]
|
||||||
@@ -33,6 +33,9 @@ from ..backend.docker.egress_apply import (
|
|||||||
from ..backend.macos_container.egress_apply import (
|
from ..backend.macos_container.egress_apply import (
|
||||||
apply_routes_change as _macos_apply_routes_change,
|
apply_routes_change as _macos_apply_routes_change,
|
||||||
)
|
)
|
||||||
|
from ..backend.smolmachines.egress_apply import (
|
||||||
|
apply_routes_change as _smolmachines_apply_routes_change,
|
||||||
|
)
|
||||||
from ..log import Die, error, info
|
from ..log import Die, error, info
|
||||||
|
|
||||||
|
|
||||||
@@ -78,8 +81,11 @@ ApplyError = (CapabilityApplyError, EgressApplyError)
|
|||||||
|
|
||||||
def apply_routes_change(slug: str, content: str) -> tuple[str, str]:
|
def apply_routes_change(slug: str, content: str) -> tuple[str, str]:
|
||||||
meta = read_metadata(slug)
|
meta = read_metadata(slug)
|
||||||
if meta is not None and meta.backend == "macos-container":
|
backend = meta.backend if meta is not None else ""
|
||||||
|
if backend == "macos-container":
|
||||||
return _macos_apply_routes_change(slug, content)
|
return _macos_apply_routes_change(slug, content)
|
||||||
|
if backend == "smolmachines":
|
||||||
|
return _smolmachines_apply_routes_change(slug, content)
|
||||||
return _docker_apply_routes_change(slug, content)
|
return _docker_apply_routes_change(slug, content)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user