Fix custom policies rollout

In case of horizon_policy_overrides defenition role will fail due to
multiple reasons. First of all, policies are in YAML format for a while
now, so json is not applicable. On top of that rollout process
is off, since default horizon policies are basically empty files, as all
policies in them are commented out.

So once we read them and supply as content - override is failing, as
it's treating the content as None, since there's nothing to merge with.

With that in mind, it makes sense to simplify the process by removing
original policy fetch and just fully override it by user supplied
content.

We keep the old format of horizon_policy_overrides where services
are split be sections, so each service will be placed in it's own
policy file.

Change-Id: I2dfae4fa31d397938077bfa817261b6a42259482
This commit is contained in:
Dmitriy Rabotyagov 2024-09-12 17:01:22 +02:00
parent b0d9b99f70
commit e042e75dd9

View File

@ -65,20 +65,15 @@
mode: "0755"
notify: Restart wsgi process
- name: Retrieve horizon policy files
slurp:
src: "{{ horizon_lib_dir }}/openstack_dashboard/conf/{{ item }}_policy.yaml"
with_items: "{{ horizon_policy_overrides.keys() | list }}"
register: _horizon_policy
- name: Place policy overrides
openstack.config_template.config_template:
content: "{{ item.content | b64decode }}"
dest: "{{ item.source }}"
content: "{{ item.value }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/{{ item.key }}_policy.yaml"
owner: root
group: "{{ horizon_system_group_name }}"
mode: "0644"
config_type: json
config_overrides: "{{ horizon_policy_overrides[item.item] }}"
with_items: "{{ _horizon_policy.results }}"
config_type: yaml
with_dict: "{{ horizon_policy_overrides }}"
- name: Uploading horizon custom files
copy: