From 1ae203e715acf1b3cd51c78de3500e7da4b707e4 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 14 Mar 2024 18:36:34 +0100 Subject: [PATCH] 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] https://github.com/gnocchixyz/gnocchi/commit/6ad4bb8e62f2ab6f5e80e94d0e055a748f914561 Change-Id: Ie7923f3b1fa3fcf3f463b476f908be09533e103a --- defaults/main.yml | 3 +-- handlers/main.yml | 2 +- tasks/gnocchi_post_install.yml | 3 +-- vars/main.yml | 5 ----- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 9e30e8d..57000d8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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. diff --git a/handlers/main.yml b/handlers/main.yml index 8867dea..639aff7 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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 diff --git a/tasks/gnocchi_post_install.yml b/tasks/gnocchi_post_install.yml index 00abfc9..4cca835 100644 --- a/tasks/gnocchi_post_install.yml +++ b/tasks/gnocchi_post_install.yml @@ -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 @@ -44,7 +43,7 @@ - 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 }}" notify: - Restart gnocchi services - Restart uwsgi services diff --git a/vars/main.yml b/vars/main.yml index 571ec1e..b77070b 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -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