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" - "Restart mistral 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/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
file: file:
path: "/etc/mistral/policy.json" path: "/etc/mistral/policy.json"
state: absent state: absent
when:
- mistral_policy_overrides == {}
listen: listen:
- "Restart mistral services" - "Restart mistral services"
- "venv changed" - "venv changed"

View File

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