From 0f7971c9cba754ae11de5ea93e61e5c441cb7cc8 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 10 Mar 2020 14:25:44 +0200 Subject: [PATCH] Fix glance policy.json deployment Glance has dropped default policy.json [1] which was used by "smart sources". We are fixing this by setting content to empty dict, that way the only content deployed will be the one provided by overrides, so that won't change current behaviour. Additionally `glance_policy_content` has been introduced, which eventually is going to replace `glance_policy_overrides` in the future. [1] https://opendev.org/openstack/glance/commit/dd1975bd3ef690d8bf1272923f0eac7beab48c6d Change-Id: I3f365684542b390ea02c08ab56f76a447f65a814 --- defaults/main.yml | 1 + tasks/glance_post_install.yml | 8 +++++++- vars/main.yml | 5 ----- vars/redhat.yml | 5 ----- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6b72cad9..a7d683d6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -303,6 +303,7 @@ glance_glance_scrubber_conf_overrides: {} glance_glance_scheme_json_overrides: {} glance_glance_swift_store_conf_overrides: {} glance_policy_overrides: {} +glance_policy_content: {} glance_api_uwsgi_ini_overrides: {} # Specify path on the local filesystem for glance-image-import.conf diff --git a/tasks/glance_post_install.yml b/tasks/glance_post_install.yml index b54e8f29..e490c76f 100644 --- a/tasks/glance_post_install.yml +++ b/tasks/glance_post_install.yml @@ -41,7 +41,8 @@ - name: Deploy Glance configuration files config_template: - src: "{{ item.src }}" + src: "{{ item.src | default(omit) }}" + content: "{{ item.content | default(omit) }}" dest: "{{ item.dest }}" owner: "root" group: "{{ glance_system_group_name }}" @@ -79,6 +80,11 @@ dest: "{{ glance_etc_dir }}/schema-image.json" config_overrides: "{{ glance_glance_scheme_json_overrides }}" config_type: "json" + - dest: "{{ glance_etc_dir }}/policy.json" + config_overrides: "{{ glance_policy_overrides }}" + config_type: "json" + condition: "{{ (glance_policy_overrides) or (glance_policy_content) }}" + content: "{{ glance_policy_content }}" notify: - Manage LB - Restart glance services diff --git a/vars/main.yml b/vars/main.yml index a9697b8e..7da19e6f 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -63,11 +63,6 @@ glance_mount_points: |- {{ mps }} glance_core_files: - - tmp_f: "/tmp/policy.json" - target_f: "{{ glance_etc_dir }}/policy.json" - config_overrides: "{{ glance_policy_overrides }}" - config_type: "json" - condition: true - tmp_f: "/tmp/glance-registry-paste.ini" target_f: "{{ glance_etc_dir }}/glance-registry-paste.ini" config_overrides: "{{ glance_glance_registry_paste_ini_overrides }}" diff --git a/vars/redhat.yml b/vars/redhat.yml index 110fe4ff..58cc0fa1 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -34,11 +34,6 @@ glance_oslomsg_amqp1_distro_packages: - cyrus-sasl-md5 glance_core_files: - - tmp_f: "/tmp/policy.json" - target_f: "{{ glance_etc_dir }}/policy.json" - config_overrides: "{{ glance_policy_overrides }}" - config_type: "json" - condition: true - tmp_f: "/tmp/glance-registry-dist-paste.ini" target_f: "{{ (glance_install_method == 'source') | ternary((glance_etc_dir ~ '/glance-registry-paste.ini'), '/usr/share/glance/glance-registry-dist-paste.ini') }}" target_f_override: "{{ glance_etc_dir }}/glance-registry-paste.ini"