summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2017-04-27 03:59:59 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-04-27 03:59:59 +0000
commit51b2ad855f0dad6527e5ec436f6b29758c21fb80 (patch)
treebec889e9e3062b9e884eb36bb830cda3d086c98c /tests/lib
parente3f9edb5064e280056addd6fc47535d3ee1a2435 (diff)
parent661fbc57a5cd5137a58cc6a285f4b6f91d78e0f0 (diff)
Merge "Change role of doctor user to _member_"
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/installers/fuel38
1 files changed, 38 insertions, 0 deletions
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
}