Merge "[goal] Deprecate the JSON formatted policy file"

This commit is contained in:
Zuul
2021-04-06 12:33:11 +00:00
committed by Gerrit Code Review
2 changed files with 22 additions and 30 deletions

View File

@@ -27,34 +27,11 @@
- "Restart designate services" - "Restart designate services"
- "venv changed" - "venv changed"
# Note (odyssey4me): # NOTE (noonedeadpunk): Remove this task after Xena release
# The policy.json file is currently read continually by the services - name: Remove obsoleted policy.json
# and is not only read on service start. We therefore cannot template
# directly to the file read by the service because the new policies
# may not be valid until the service restarts. This is particularly
# important during a major upgrade. We therefore only put the policy
# file in place after the service has been stopped.
#
- name: Copy new policy file into place
copy:
src: "/etc/designate/policy.json-{{ designate_venv_tag }}"
dest: "/etc/designate/policy.json"
owner: "root"
group: "{{ designate_system_group_name }}"
mode: "0640"
remote_src: yes
when:
- designate_policy_overrides != {}
listen:
- "Restart designate services"
- "venv changed"
- name: Remove legacy policy.json file
file: file:
path: "/etc/designate/policy.json" path: "/etc/designate/policy.json"
state: absent state: absent
when:
- designate_policy_overrides == {}
listen: listen:
- "Restart designate services" - "Restart designate services"
- "venv changed" - "venv changed"

View File

@@ -57,12 +57,27 @@
config_type: "ini" config_type: "ini"
notify: Restart designate services notify: Restart designate services
- name: Implement policy.json if there are overrides configured - name: Implement policy.yaml if there are overrides configured
copy: config_template:
content: "{{ designate_policy_overrides | to_nice_json }}" content: "{{ designate_policy_overrides }}"
dest: "/etc/designate/policy.json-{{ designate_venv_tag }}" dest: "/etc/designate/policy.yaml"
owner: "{{ designate_system_user_name }}"
group: "{{ designate_system_group_name }}"
mode: "0644"
config_type: yaml
when: when:
- designate_policy_overrides != {} - designate_policy_overrides | length > 0
tags:
- designate-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/designate/policy.yaml"
state: absent
when:
- designate_policy_overrides | length == 0
tags:
- designate-policy-override
- name: Create Designate pools.yaml file - name: Create Designate pools.yaml file
copy: copy: