Merge "Set KOLLA_SERVICE_NAME in Podman containers"
This commit is contained in:
commit
d21adedea8
@ -565,3 +565,14 @@ class ContainerWorker(ABC):
|
||||
@abstractmethod
|
||||
def ensure_image(self):
|
||||
pass
|
||||
|
||||
def _inject_env_var(self, environment_info):
|
||||
newenv = {
|
||||
'KOLLA_SERVICE_NAME': self.params.get('name').replace('_', '-')
|
||||
}
|
||||
environment_info.update(newenv)
|
||||
return environment_info
|
||||
|
||||
def _format_env_vars(self):
|
||||
env = self._inject_env_var(self.params.get('environment'))
|
||||
return {k: "" if env[k] is None else env[k] for k in env}
|
||||
|
@ -310,17 +310,6 @@ class DockerWorker(ContainerWorker):
|
||||
|
||||
return host_config
|
||||
|
||||
def _inject_env_var(self, environment_info):
|
||||
newenv = {
|
||||
'KOLLA_SERVICE_NAME': self.params.get('name').replace('_', '-')
|
||||
}
|
||||
environment_info.update(newenv)
|
||||
return environment_info
|
||||
|
||||
def _format_env_vars(self):
|
||||
env = self._inject_env_var(self.params.get('environment'))
|
||||
return {k: "" if env[k] is None else env[k] for k in env}
|
||||
|
||||
def build_container_options(self):
|
||||
volumes, binds = self.generate_volumes()
|
||||
|
||||
|
@ -94,11 +94,9 @@ class PodmanWorker(ContainerWorker):
|
||||
args['mounts'] = mounts
|
||||
args['volumes'] = filtered_volumes
|
||||
|
||||
# in case value is not string it has to be converted
|
||||
environment = self.params.get('environment')
|
||||
if environment:
|
||||
for key, value in environment.items():
|
||||
environment[key] = str(value)
|
||||
env = self._format_env_vars()
|
||||
args['environment'] = {k: str(v) for k, v in env.items()}
|
||||
self.params.pop('environment', None)
|
||||
|
||||
healthcheck = self.params.get('healthcheck')
|
||||
if healthcheck:
|
||||
|
7
releasenotes/notes/bug-2078940-45db7a8cc224d586.yaml
Normal file
7
releasenotes/notes/bug-2078940-45db7a8cc224d586.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes issue in PodmanWorker where it didn't set KOLLA_SERVICE_NAME
|
||||
environment variable when creating new container.
|
||||
Additionally, two methods were moved from DockerWorker
|
||||
to ContainerWorker as they are applicable to both engines.
|
Loading…
Reference in New Issue
Block a user