Merge "Fix copying Swift ring files"

This commit is contained in:
Zuul 2021-02-03 13:36:43 +00:00 committed by Gerrit Code Review
commit 8941ebe06e
4 changed files with 25 additions and 9 deletions

View File

@ -101,7 +101,7 @@
- item.0.item.enabled | bool
- item.1.path | basename not in item.0.item.ignore | default([])
- name: Ensure extra configuration files exist
- name: Ensure templated extra configuration files exist
template:
src: "{{ item.1.path }}"
dest: "{{ item.0.item.dest }}/{{ item.1.path | relpath(item.0.item.src) }}"
@ -113,6 +113,21 @@
when:
- item.0.item.enabled | bool
- item.1.path | basename not in item.0.item.ignore | default([])
- item.1.path | basename not in item.0.item.untemplated | default([])
- name: Ensure untemplated extra configuration files exist
copy:
src: "{{ item.1.path }}"
dest: "{{ item.0.item.dest }}/{{ item.1.path | relpath(item.0.item.src) }}"
mode: 0640
with_subelements:
- "{{ find_src_result.results }}"
- files
- skip_missing: true
when:
- item.0.item.enabled | bool
- item.1.path | basename not in item.0.item.ignore | default([])
- item.1.path | basename in item.0.item.untemplated | default([])
- name: Ensure unnecessary extra configuration files are absent
file:

View File

@ -120,7 +120,7 @@ def main():
build_path = sys.argv[2]
service_name = sys.argv[3]
with open(config_path) as f:
config = yaml.load(f)
config = yaml.safe_load(f)
build_rings(config, build_path, service_name)

View File

@ -6,11 +6,6 @@
# Execute the following commands on the ring build host.
- block:
# Facts required for ansible_user_uid and ansible_user_gid.
- name: Gather facts for swift ring build host
setup:
when: not module_setup | default(false)
- name: Ensure Swift ring build directory exists
file:
path: "{{ swift_ring_build_path }}"
@ -20,6 +15,7 @@
copy:
src: swift-ring-builder.py
dest: "{{ swift_ring_build_path }}"
register: copy_result
- name: Ensure Swift ring builder configuration exists
template:
@ -33,14 +29,14 @@
docker_container:
cleanup: true
command: >-
python {{ swift_container_build_path }}/swift-ring-builder.py
python3 {{ swift_container_build_path }}/swift-ring-builder.py
{{ swift_container_build_path }}/{{ item }}-ring.yml
{{ swift_container_build_path }}
{{ item }}
detach: false
image: "{{ swift_ring_build_image }}"
name: "swift_{{ item }}_ring_builder"
user: "{{ ansible_user_uid }}:{{ ansible_user_gid }}"
user: "{{ copy_result.uid }}:{{ copy_result.gid }}"
volumes:
- "{{ swift_ring_build_path }}/:{{ swift_container_build_path }}/"
with_items: "{{ swift_service_names }}"

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes an issue with copying Swift ring files. See `story 2007297
<https://storyboard.openstack.org/#!/story/2007297>`__ for details.