[goal] Deprecate the JSON formatted policy file

As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to replace policy.json to
policy.yaml and remove deprecated policy.json.

[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Change-Id: I71d9f02360e10fe45d1e956e3a59326e8ba1263a
This commit is contained in:
Dmitriy Rabotyagov 2021-03-16 17:05:33 +02:00 committed by Dmitriy Rabotyagov
parent d843d22e11
commit f51605df76
2 changed files with 22 additions and 30 deletions

View File

@ -27,34 +27,11 @@
- "Restart designate services"
- "venv changed"
# Note (odyssey4me):
# The policy.json file is currently read continually by the services
# 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
# NOTE (noonedeadpunk): Remove this task after Xena release
- name: Remove obsoleted policy.json
file:
path: "/etc/designate/policy.json"
state: absent
when:
- designate_policy_overrides == {}
listen:
- "Restart designate services"
- "venv changed"

View File

@ -57,12 +57,27 @@
config_type: "ini"
notify: Restart designate services
- name: Implement policy.json if there are overrides configured
copy:
content: "{{ designate_policy_overrides | to_nice_json }}"
dest: "/etc/designate/policy.json-{{ designate_venv_tag }}"
- name: Implement policy.yaml if there are overrides configured
config_template:
content: "{{ designate_policy_overrides }}"
dest: "/etc/designate/policy.yaml"
owner: "{{ designate_system_user_name }}"
group: "{{ designate_system_group_name }}"
mode: "0644"
config_type: yaml
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
copy: