From 661fbc57a5cd5137a58cc6a285f4b6f91d78e0f0 Mon Sep 17 00:00:00 2001 From: Tomi Juvonen Date: Thu, 15 Dec 2016 10:10:07 +0200 Subject: Change role of doctor user to _member_ Change role of doctor user to _member_ Do needful changes to API calls Add admin a role to project Add Fuel support JIRA: DOCTOR-80 Change-Id: Ic7f88b9ceb6c4fc90e5e985ecfbc50c907b2367e Signed-off-by: Tomi Juvonen --- tests/lib/installers/fuel | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests/lib/installers/fuel') diff --git a/tests/lib/installers/fuel b/tests/lib/installers/fuel index da0de34b..0c56963c 100644 --- a/tests/lib/installers/fuel +++ b/tests/lib/installers/fuel @@ -74,6 +74,31 @@ function installer_apply_patches { ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy restart fi fi + + np_conf=/etc/nova/policy.json + if [ -e $np_conf ]; then + entry="os_compute_api:servers:show:host_status" + new="rule:admin_or_owner" + np_backup="${np_conf}-doctor-saved" + if grep -q "${entry}.*${new}" $np_conf; then + echo "Not modifying nova policy" + elif grep -q "${entry}" $np_conf; then + echo "modify nova policy" + cp $np_conf $np_backup + oldline=$(grep "$entry" $np_conf) + newline=$(echo "$oldline" | sed "s/rule.*\"/$new\"/") + sed -i "s/$oldline/$newline/" $np_conf + service nova-api restart + else + echo "add nova policy" + cp $np_conf $np_backup + sed -i "/{/a \ \"${entry}\": \"$new\"" $np_conf + service nova-api restart + fi + else + # TODO(tojuvone) policy.json might not exists in Ocata. + echo "$np_conf does not exist!!!" + fi ' > installer_apply_patches_$node.log 2>&1 done } @@ -83,6 +108,8 @@ function setup_installer { installer_get_ssh_keys get_controller_ips installer_apply_patches + #Might take a moment for nova-api to restart + sleep 20 if ! openstack flavor show $VM_FLAVOR ; then openstack flavor create --ram 512 --disk 1 $VM_FLAVOR \ && touch created_doctor_flavor @@ -138,6 +165,17 @@ function installer_revert_patches { sed -ie "/# added by doctor script/d" $ep_conf service ceilometer-agent-notification restart 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 + fi ' >> installer_apply_patches_$node.log 2>&1 done } -- cgit 1.2.3-korg