mirror of
https://github.com/ansible/ansible.git
synced 2026-07-28 08:05:22 +02:00
Fix galaxy container setup issues with podman (#86801)
This commit is contained in:
@@ -81,7 +81,20 @@ class GalaxyProvider(CloudProvider):
|
||||
# This container is created separately from the actual galaxy container due to
|
||||
# needing it created for postgres, but the galaxy container has a dependency on knowing the postgres
|
||||
# container id
|
||||
gdata = run_support_container(self.args, self.platform, self.galaxy_image, 'galaxy-data', [0], start=False)
|
||||
#
|
||||
# Podman does not extract the image contents until the container starts, this is not true of Docker.
|
||||
# The container will start and then immediately exit to conserve resources.
|
||||
gdata = run_support_container(
|
||||
self.args,
|
||||
self.platform,
|
||||
self.galaxy_image,
|
||||
'galaxy-data',
|
||||
[],
|
||||
publish_ports=False,
|
||||
cmd=['/bin/true'],
|
||||
start=True,
|
||||
data_container=True,
|
||||
)
|
||||
if not gdata:
|
||||
return
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ def run_support_container(
|
||||
env: t.Optional[dict[str, str]] = None,
|
||||
options: t.Optional[list[str]] = None,
|
||||
publish_ports: bool = True,
|
||||
data_container: bool = False,
|
||||
) -> t.Optional[ContainerDescriptor]:
|
||||
"""
|
||||
Start a container used to support tests, but not run them.
|
||||
@@ -178,6 +179,7 @@ def run_support_container(
|
||||
running,
|
||||
cleanup,
|
||||
env,
|
||||
data_container,
|
||||
)
|
||||
|
||||
with support_containers_mutex:
|
||||
@@ -366,7 +368,7 @@ class ContainerAccess:
|
||||
if self.forwards:
|
||||
ports = list(self.forwards.items())
|
||||
else:
|
||||
ports = [(port, port) for port in self.ports]
|
||||
ports = [(port, port) for port in self.ports or []]
|
||||
|
||||
return ports
|
||||
|
||||
@@ -451,7 +453,7 @@ def create_container_database(args: EnvironmentConfig) -> ContainerDatabase:
|
||||
managed: dict[str, dict[str, ContainerAccess]] = {}
|
||||
|
||||
for name, container in support_containers.items():
|
||||
if container.details is None:
|
||||
if container.data_container:
|
||||
# data containers will not be started, and will be missing details
|
||||
continue
|
||||
if container.details.published_ports:
|
||||
@@ -662,6 +664,7 @@ class ContainerDescriptor:
|
||||
running: bool,
|
||||
cleanup: bool,
|
||||
env: t.Optional[dict[str, str]],
|
||||
data_container: bool,
|
||||
) -> None:
|
||||
self.image = image
|
||||
self.context = context
|
||||
@@ -674,6 +677,7 @@ class ContainerDescriptor:
|
||||
self.cleanup = cleanup
|
||||
self.env = env
|
||||
self.details: t.Optional[SupportContainer] = None
|
||||
self.data_container = data_container
|
||||
|
||||
def start(self, args: EnvironmentConfig) -> None:
|
||||
"""Start the container. Used for containers which are created, but not started."""
|
||||
|
||||
Reference in New Issue
Block a user