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

This commit is contained in:
Zuul 2021-04-08 18:24:43 +00:00 committed by Gerrit Code Review
commit 7fa4a4eb63
2 changed files with 22 additions and 33 deletions

View File

@ -28,34 +28,11 @@
- "Restart mistral 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/mistral/policy.json-{{ mistral_venv_tag }}"
dest: "/etc/mistral/policy.json"
owner: "root"
group: "{{ mistral_system_group_name }}"
mode: "0640"
remote_src: yes
when:
- mistral_policy_overrides != {}
listen:
- "Restart mistral 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/mistral/policy.json"
state: absent
when:
- mistral_policy_overrides == {}
listen:
- "Restart mistral services"
- "venv changed"

View File

@ -32,12 +32,24 @@
- Restart mistral services
- Restart uwsgi services
- name: Implement policy.json if there are overrides configured
copy:
content: "{{ mistral_policy_overrides | to_nice_json }}"
dest: "/etc/mistral/policy.json-{{ mistral_venv_tag }}"
- name: Implement policy.yaml if there are overrides configured
config_template:
content: "{{ mistral_policy_overrides }}"
dest: "/etc/mistral/policy.yaml"
owner: "root"
group: "{{ mistral_system_group_name }}"
mode: "0640"
config_type: yaml
when:
- mistral_policy_overrides != {}
notify:
- Manage LB
- Restart mistral services
- mistral_policy_overrides | length > 0
tags:
- mistral-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/mistral/policy.yaml"
state: absent
when:
- mistral_policy_overrides | length == 0
tags:
- mistral-policy-override