diff options
author | Umar Farooq <umar.farooq@neclab.eu> | 2017-05-29 18:42:43 +0000 |
---|---|---|
committer | Umar Farooq <umar.farooq@neclab.eu> | 2017-07-03 10:40:11 +0000 |
commit | 76dadb96e17e4d066facf0a185a1032e40b980f7 (patch) | |
tree | 19e0805e32fa948a412af6daa1f3949b4d544757 /tests/lib/installers/fuel | |
parent | f77107087079caa9b1602be6308d98107c9639b8 (diff) |
Create policy.json file in Ocata for non-admin user
Non-admin user is not allowed to view host_status flag.
To get the host status, policy.json file needs to be
created as it is not available in Ocata by default.
This is created for local and fuel installer types
in this commit.
JIRA: DOCTOR-110
Change-Id: Ie626217a515f821c47b1cb6ed0e3d504d8e01b3a
Signed-off-by: Umar Farooq <umar.farooq@neclab.eu>
Diffstat (limited to 'tests/lib/installers/fuel')
-rw-r--r-- | tests/lib/installers/fuel | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/tests/lib/installers/fuel b/tests/lib/installers/fuel index 0c56963c..85865720 100644 --- a/tests/lib/installers/fuel +++ b/tests/lib/installers/fuel @@ -96,8 +96,15 @@ function installer_apply_patches { service nova-api restart fi else - # TODO(tojuvone) policy.json might not exists in Ocata. - echo "$np_conf does not exist!!!" + # policy.json does not exist in Ocata. + echo "$np_conf does not exist. Creating new one." + echo -e "{\n \"context_is_admin\": \"role:admin\"," > $np_conf + echo -e " \"owner\" : \"user_id:%(user_id)s\"," >> $np_conf + echo -e " \"admin_or_owner\": \"rule:context_is_admin or rule:owner\"," >> $np_conf + echo -e " \"os_compute_api:servers:show:host_status\": \"rule:admin_or_owner\" \n}" >> $np_conf + np_rm="${np_conf}-doctor-rm" + cp $np_conf $np_rm + service nova-api restart fi ' > installer_apply_patches_$node.log 2>&1 done @@ -167,14 +174,16 @@ function installer_revert_patches { fi np_conf=/etc/nova/policy.json - entry="os_compute_api:servers:show:host_status" - if [ -e $np_conf ]; then - np_backup="${np_conf}-doctor-saved" - if [ -e $np_backup ]; then - cp -f $np_backup $np_conf - rm $np_backup - service nova-api restart - fi + np_backup="${np_conf}-doctor-saved" + np_rm="${np_conf}-doctor-rm" + if [ -e $np_backup ]; then + cp -f $np_backup $np_conf + rm $np_backup + service nova-api restart + elif [ -e $np_rm ]; then + rm $np_conf + rm $np_rm + service nova-api restart fi ' >> installer_apply_patches_$node.log 2>&1 done |