diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2025-09-10 07:44:04 +0200 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2025-10-28 11:26:36 +0000 |
| commit | 3380770aeef5eebc4fd0dd1f7b6c36cde0c881fa (patch) | |
| tree | 1ded558649c141bb80019d49ea92a71743e6ec16 /ansible/module_utils | |
| parent | 011034a141b385ed4c86fd832425e800484efdb6 (diff) | |
| download | kolla-ansible-3380770aeef5eebc4fd0dd1f7b6c36cde0c881fa.tar.gz kolla-ansible-3380770aeef5eebc4fd0dd1f7b6c36cde0c881fa.zip | |
Bump ansible-core to 2.18/2.19
Bumped collections in requirements-core.yml to Ansible 12 major versions,
see [1].
[1]: https://github.com/ansible-community/ansible-build-data/blob/main/12/ansible-12.1.0.yaml
Depends-On: https://review.opendev.org/c/openstack/kolla/+/960307
Co-authored-by: Doug Szumski doug@stackhpc.com
Change-Id: If8a29052d8a43ffc0fef11514adabb5e4ab9d977
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
Diffstat (limited to 'ansible/module_utils')
| -rw-r--r-- | ansible/module_utils/kolla_container_worker.py | 2 | ||||
| -rw-r--r-- | ansible/module_utils/kolla_docker_worker.py | 7 | ||||
| -rw-r--r-- | ansible/module_utils/kolla_podman_worker.py | 14 |
3 files changed, 15 insertions, 8 deletions
diff --git a/ansible/module_utils/kolla_container_worker.py b/ansible/module_utils/kolla_container_worker.py index 3e16ac2c9..d9d2bf714 100644 --- a/ansible/module_utils/kolla_container_worker.py +++ b/ansible/module_utils/kolla_container_worker.py @@ -410,7 +410,7 @@ class ContainerWorker(ABC): vol_dict = dict() for vol in volumes: - if len(vol) == 0: + if not vol: continue if ':' not in vol: diff --git a/ansible/module_utils/kolla_docker_worker.py b/ansible/module_utils/kolla_docker_worker.py index f0799f064..267cc27a8 100644 --- a/ansible/module_utils/kolla_docker_worker.py +++ b/ansible/module_utils/kolla_docker_worker.py @@ -469,8 +469,11 @@ class DockerWorker(ContainerWorker): labels={'kolla_managed': 'true'}) def create_container_volumes(self): - volumes = self.params.get("volumes", []) - + volumes = self.params.get('volumes') + if not volumes: + return + # Filter out null / empty string volumes + volumes = [v for v in volumes if v] for volume in volumes: volume_name = volume.split(":")[0] if "/" in volume_name: diff --git a/ansible/module_utils/kolla_podman_worker.py b/ansible/module_utils/kolla_podman_worker.py index f26846ded..d7b09a135 100644 --- a/ansible/module_utils/kolla_podman_worker.py +++ b/ansible/module_utils/kolla_podman_worker.py @@ -85,7 +85,7 @@ class PodmanWorker(ContainerWorker): # functionality is broken mounts = [] filtered_volumes = {} - volumes = self.params.get('volumes', []) + volumes = self.params.get('volumes') if volumes: self.parse_volumes(volumes, mounts, filtered_volumes) # we can delete original volumes so it won't raise error later @@ -149,10 +149,10 @@ class PodmanWorker(ContainerWorker): # Therefore, we must parse them and set the permissions ourselves # and send them to API separately. def parse_volumes(self, volumes, mounts, filtered_volumes): - # we can ignore empty strings - volumes = [item for item in volumes if item.strip()] - for item in volumes: + if not item or not item.strip(): + # we can ignore empty strings or null volumes + continue # if it starts with / it is bind not volume if item[0] == '/': mode = None @@ -642,7 +642,11 @@ class PodmanWorker(ContainerWorker): self.result = vol.attrs def create_container_volumes(self): - volumes = self.params.get("volumes", []) or [] + volumes = self.params.get('volumes') + if not volumes: + return + # Filter out null / empty string volumes + volumes = [v for v in volumes if v] for volume in volumes: volume_name = volume.split(":")[0] |
