Manage `policy.json` file
The default location of this file has been /etc/cinder/policy.json.
Starting Queens release, the default location of this file is changed
to /etc/cinder/policy.yaml.
The policy file to be used may be specified in the /etc/cinder/cinder.conf
file in the [oslo_policy] section as the value of the
`policy_file=policy.json` by default.
Change-Id: I5de35a691c2c3115c13d3db3b220fb8cc4c80355
Related-Prod: PROD-23724 (PROD:23724)
diff --git a/cinder/controller.sls b/cinder/controller.sls
index 8e7023c..271e01e 100644
--- a/cinder/controller.sls
+++ b/cinder/controller.sls
@@ -153,6 +153,17 @@
{% endif %}
+{%- if controller.version not in ["juno", "kilo", "liberty", "mitaka", "newton", "ocata", "pike"] %}
+{#- Since Queens reliase `policy.json` is changed to `policy.yaml`. But default option in `oslo_policy` is `policy.json` #}
+/etc/cinder/{{ controller.policy_file }}:
+ file.managed:
+ - mode: 0640
+ - user: root
+ - group: cinder
+ - require:
+ - pkg: cinder_controller_packages
+{%- endif %}
+
{%- for name, rule in controller.get('policy', {}).items() %}
{%- if rule != None %}
diff --git a/cinder/map.jinja b/cinder/map.jinja
index 18050cf..a2ae973 100644
--- a/cinder/map.jinja
+++ b/cinder/map.jinja
@@ -15,6 +15,7 @@
'wipe_method': 'none',
'notification': False,
'cors': {},
+ 'policy_file': 'policy.json',
'audit': {
'enabled': false
},
@@ -46,6 +47,7 @@
'wipe_method': 'none',
'notification': False,
'cors': {},
+ 'policy_file': 'policy.json',
'audit': {
'enabled': false
},