[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: Iede5a9f0387baaf9c72bd060b59435ffaa76f1bd
This commit is contained in:
Dmitriy Rabotyagov 2021-03-16 16:49:23 +02:00 committed by Dmitriy Rabotyagov
parent 538ada902f
commit 6b5a93edb9
2 changed files with 27 additions and 9 deletions

View File

@ -28,6 +28,15 @@
- "Restart cinder services"
- "venv changed"
# NOTE (noonedeadpunk): Remove this task after Xena release
- name: Remove obsoleted policy.json file
file:
path: "/etc/cinder/policy.json"
state: absent
listen:
- Restart cinder services
- venv changed
- name: Start services
service:
name: "{{ item.service_name }}"

View File

@ -63,20 +63,29 @@
- cinder-config
- cinder-post-install
- name: Implement policy.json if there are overrides configured
copy:
content: "{{ cinder_policy_overrides | to_nice_json }}"
dest: "/etc/cinder/policy.json"
notify:
- Manage LB
- Restart cinder services
- Restart uwsgi services
- name: Implement policy.yaml if there are overrides configured
config_template:
content: "{{ cinder_policy_overrides }}"
dest: "/etc/cinder/policy.yaml"
owner: "root"
group: "{{ cinder_system_group_name }}"
mode: "0640"
config_type: yaml
when:
- cinder_policy_overrides != {}
- cinder_policy_overrides | length > 0
tags:
- cinder-config
- cinder-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/cinder/policy.yaml"
state: absent
when:
- cinder_policy_overrides | length == 0
tags:
- cinder-policy-override
# NOTE(cloudnull): This is using "cp" instead of copy with a remote_source
# because we only want to copy the original files once. and we
# don't want to need multiple tasks.