Drop default policy file location

With master version of Gnocchi[1], default policy file is no longer provided
since all policies are currently stored in code.

Moreover, it's long due to switch policy formats to YAML instead of
json.

[1] 6ad4bb8e62

Change-Id: Ie7923f3b1fa3fcf3f463b476f908be09533e103a
This commit is contained in:
Dmitriy Rabotyagov 2024-03-14 18:36:34 +01:00
parent d44b25ebb8
commit 8abf57abc2
4 changed files with 6 additions and 10 deletions

View File

@ -215,14 +215,13 @@ gnocchi_memcached_servers: "{{ memcached_servers }}"
# not exist then the default files will be sourced from the
# service git repository.
gnocchi_api_paste_default_file_path: "/etc/openstack_deploy/gnocchi/api-paste.ini"
gnocchi_policy_default_file_path: "/etc/openstack_deploy/gnocchi/policy.json"
gnocchi_policy_default_file_path: "/etc/openstack_deploy/gnocchi/policy.yaml"
# If the above-mentioned files do not exist, then these
# paths will be used to find the files from the git config
# lookup location.
gnocchi_git_config_lookup_location: https://raw.githubusercontent.com/gnocchixyz/gnocchi/{{ gnocchi_git_install_branch }}/
gnocchi_api_paste_git_file_path: "gnocchi/rest/api-paste.ini"
gnocchi_policy_git_file_path: "gnocchi/rest/policy.json"
# Tunable var-based overrides
# The contents of these are templated over the default files.

View File

@ -34,7 +34,7 @@
- "cert installed"
# Note (odyssey4me):
# The policy.json file is currently read continually by the services
# The policy.yaml 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
@ -49,6 +49,7 @@
group: "{{ gnocchi_system_group_name }}"
mode: "0640"
remote_src: yes
when: gnocchi_policy_user_content | length > 0
listen:
- "Restart gnocchi services"
- "venv changed"

View File

@ -19,7 +19,6 @@
return_content: yes
with_items:
- "{{ gnocchi_git_config_lookup_location }}/{{ gnocchi_api_paste_git_file_path }}"
- "{{ gnocchi_git_config_lookup_location }}/{{ gnocchi_policy_git_file_path }}"
register: _git_file_fetch
- name: Copy gnocchi configuration files
@ -32,6 +31,7 @@
mode: "{{ item.mode | default('0644') }}"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
when: "{{ item.condition }}"
with_items:
- src: "gnocchi.conf.j2"
dest: "/etc/gnocchi/gnocchi.conf"
@ -44,7 +44,8 @@
- dest: "/etc/gnocchi/policy.yaml-{{ gnocchi_venv_tag }}"
config_overrides: "{{ gnocchi_policy_overrides }}"
config_type: "yaml"
content: "{{ gnocchi_policy_user_content | default(gnocchi_policy_default_content, true) }}"
content: "{{ gnocchi_policy_user_content }}"
condition: gnocchi_policy_user_content | length > 0
notify:
- Restart gnocchi services
- Restart uwsgi services

View File

@ -29,11 +29,6 @@ gnocchi_api_paste_default_content: |
_git_file_fetch.results | selectattr(
'item', 'equalto', gnocchi_git_config_lookup_location ~ '/' ~ gnocchi_api_paste_git_file_path) | map(attribute='content') | first
}}
gnocchi_policy_default_content: |
{{
_git_file_fetch.results | selectattr(
'item', 'equalto', gnocchi_git_config_lookup_location ~ '/' ~ gnocchi_policy_git_file_path) | map(attribute='content') | first
}}
# NOTE(noonedeadpunk): We prefer using ceph_alternative when storage driver is ceph.
# However, if we define ceph_alternative here, gnocchi with setup.cfg