fix(smolmachines): docker push fails on Docker Desktop — daemon-side route differs from host loopback #74
@@ -117,12 +117,21 @@ def machine_create(
|
|||||||
Smolfile because `--from` and `--smolfile` are themselves
|
Smolfile because `--from` and `--smolfile` are themselves
|
||||||
mutually exclusive in smolvm 0.8.0 — and we want `--from`'s
|
mutually exclusive in smolvm 0.8.0 — and we want `--from`'s
|
||||||
no-pull-at-start property. The flag form gives the same
|
no-pull-at-start property. The flag form gives the same
|
||||||
result without the Smolfile complication."""
|
result without the Smolfile complication.
|
||||||
|
|
||||||
|
`--net` is sent explicitly when `allow_cidrs` is non-empty.
|
||||||
|
smolvm 0.8.0's docs say `--allow-cidr` implies `--net`, but
|
||||||
|
empirically the implication only fires when no `--from` is
|
||||||
|
set — `--from PATH --allow-cidr X/32` silently produces a
|
||||||
|
machine with `network: false` and no routes in the guest, so
|
||||||
|
the agent can't reach the bundle's pinned IP."""
|
||||||
args: list[str] = ["machine", "create"]
|
args: list[str] = ["machine", "create"]
|
||||||
if image is not None:
|
if image is not None:
|
||||||
args += ["--image", image]
|
args += ["--image", image]
|
||||||
if from_path is not None:
|
if from_path is not None:
|
||||||
args += ["--from", str(from_path)]
|
args += ["--from", str(from_path)]
|
||||||
|
if allow_cidrs:
|
||||||
|
args.append("--net")
|
||||||
for cidr in allow_cidrs:
|
for cidr in allow_cidrs:
|
||||||
args += ["--allow-cidr", cidr]
|
args += ["--allow-cidr", cidr]
|
||||||
if env:
|
if env:
|
||||||
|
|||||||
@@ -82,12 +82,20 @@ class TestArgvShapes(unittest.TestCase):
|
|||||||
self.assertEqual("smolvm", argv[0])
|
self.assertEqual("smolvm", argv[0])
|
||||||
self.assertIn("--from", argv)
|
self.assertIn("--from", argv)
|
||||||
self.assertIn("/stage/agent.smolmachine", argv)
|
self.assertIn("/stage/agent.smolmachine", argv)
|
||||||
|
# `--net` is explicit because smolvm 0.8.0's implied-net
|
||||||
|
# from --allow-cidr doesn't fire when --from is set.
|
||||||
|
self.assertIn("--net", argv)
|
||||||
self.assertIn("--allow-cidr", argv)
|
self.assertIn("--allow-cidr", argv)
|
||||||
self.assertIn("192.168.50.2/32", argv)
|
self.assertIn("192.168.50.2/32", argv)
|
||||||
self.assertIn("-e", argv)
|
self.assertIn("-e", argv)
|
||||||
self.assertIn("HTTPS_PROXY=http://192.168.50.2:8888", argv)
|
self.assertIn("HTTPS_PROXY=http://192.168.50.2:8888", argv)
|
||||||
self.assertEqual("agent-xyz", argv[-1])
|
self.assertEqual("agent-xyz", argv[-1])
|
||||||
|
|
||||||
|
def test_machine_create_omits_net_when_no_allow_cidrs(self):
|
||||||
|
with self._patch_run() as m:
|
||||||
|
machine_create("agent-xyz", from_path=Path("/x.smolmachine"))
|
||||||
|
self.assertNotIn("--net", m.call_args.args[0])
|
||||||
|
|
||||||
def test_machine_start_uses_dash_name(self):
|
def test_machine_start_uses_dash_name(self):
|
||||||
# `start` is the --name flag form, NOT positional.
|
# `start` is the --name flag form, NOT positional.
|
||||||
with self._patch_run() as m:
|
with self._patch_run() as m:
|
||||||
|
|||||||
Reference in New Issue
Block a user