compose2pod 0.4.1__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compose2pod
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Convert a Docker Compose file into a script that runs its services as a single Podman pod
5
5
  Keywords: podman,docker-compose,compose,pod,ci,testing,containers
6
6
  Author: Artur Shiriev
@@ -335,7 +335,13 @@ def _plan(compose: dict[str, Any], options: EmitOptions) -> PlannedScript:
335
335
  # Only the closure joins the pod, so only the closure is resolvable. A name
336
336
  # pointing at 127.0.0.1 for a service that never runs would turn an honest
337
337
  # resolution failure into a connection-refused.
338
- hosts = hostnames({name: services[name] for name in order})
338
+ # The pod name is added as a resolvable name so every container's own
339
+ # hostname (set to the pod name below) resolves. A pod shares one UTS
340
+ # namespace, so without this the hostname is the random container ID,
341
+ # absent from the owned /etc/hosts -- `hostname -f` then fails and images
342
+ # that resolve their own hostname at startup crash. Podman used to add this
343
+ # line itself; `--no-hosts` stops it, so the script owns it too.
344
+ hosts = [*hostnames({name: services[name] for name in order}), options.pod]
339
345
  host_tokens = hosts_file_tokens(services, order, hosts)
340
346
  completion_gated = {
341
347
  dep
@@ -355,7 +361,11 @@ def _plan(compose: dict[str, Any], options: EmitOptions) -> PlannedScript:
355
361
  lines.append(f"trap '{teardown}' EXIT")
356
362
  pod_flags = pod_create_flags(services, order)
357
363
  _collect_vars(pod_flags, names)
358
- pod_create = f"podman pod create --name {shlex.quote(options.pod)} --no-hosts"
364
+ # `--uts private` gives the pod its own UTS namespace so `--hostname` is
365
+ # settable (in the host UTS namespace Podman refuses it); the pod name is
366
+ # the shared hostname, resolvable via the line added to the hosts file above.
367
+ pod_name = shlex.quote(options.pod)
368
+ pod_create = f"podman pod create --name {pod_name} --no-hosts --uts private --hostname {pod_name}"
359
369
  if pod_flags:
360
370
  pod_create += " " + _render(pod_flags)
361
371
  lines.append(pod_create)
@@ -18,7 +18,7 @@ classifiers = [
18
18
  "Topic :: Software Development :: Libraries",
19
19
  "Topic :: Software Development :: Testing",
20
20
  ]
21
- version = "0.4.1"
21
+ version = "0.4.2"
22
22
 
23
23
  [project.optional-dependencies]
24
24
  yaml = ["PyYAML>=6"]
File without changes