Touch heat policy file before use it

Heat now move to policy in code. That means no default policy file
exists. We should touch policy file before insert rules into it.
Also change to use policy.yaml, since it's more preferred.
Co-Authored-By: Rico Lin <rico.lin@easystack.cn>
Closes-Bug: #1740357

Change-Id: I15aa04437965f0ad70f35fd26905c3d1c14df279
This commit is contained in:
ricolin 2017-12-29 13:06:02 +08:00
parent 583f2eb840
commit b05c9931d2

View File

@ -468,7 +468,8 @@ EOF
}
function modify_heat_flavor_policy_rule {
local policy_file=$HEAT_CONF_DIR/policy.json
local policy_file=$HEAT_CONF_DIR/policy.yaml
touch $policy_file
# Allow non-admin projects with 'admin' roles to create flavors in Heat
sed -i 's/"resource_types:OS::Nova::Flavor": "rule:context_is_admin"/"resource_types:OS::Nova::Flavor": "role:admin"/' $policy_file
echo '"resource_types:OS::Nova::Flavor": "role:almin"' >> $policy_file
}