- cat > set_conf.sh << 'END_TXT'
-#!/bin/bash
-if [ -e /etc/ceilometer/event_pipeline.yaml ]; then
- if ! grep -q '^ *- notifier://?topic=alarm.all$' /etc/ceilometer/event_pipeline.yaml; then
- sed -i 's|- notifier://|- notifier://?topic=alarm.all|' /etc/ceilometer/event_pipeline.yaml
- echo "modify the ceilometer config"
- service ceilometer-agent-notification restart
- fi
-else
- echo "ceilometer event_pipeline.yaml file does not exist"
- exit 1
-fi
-if [ -e /etc/nova/nova.conf ]; then
- if ! grep -q '^notification_driver=messaging$' /etc/nova/nova.conf; then
- sed -i -r 's/notification_driver=/notification_driver=messaging/g' /etc/nova/nova.conf
- echo "modify nova config"
- service nova-api restart
- fi
-else
- echo "nova.conf file does not exist"
- exit 1
-fi
-exit 0
-END_TXT
-
- chmod +x set_conf.sh
- CONTROLLER_IP=$(sshpass -p r00tme ssh 2>/dev/null $ssh_opts root@${INSTALLER_IP} \
- "fuel node | grep controller | cut -d '|' -f 5|xargs")
- for node in $CONTROLLER_IP;do
- scp $ssh_opts_cpu set_conf.sh "root@$node:"
- ssh $ssh_opts_cpu "root@$node" './set_conf.sh > set_conf.log 2>&1 &'
- sleep 1
- scp $ssh_opts_cpu "root@$node:set_conf.log" set_conf_$node.log
+ # TODO(r-mibu): fix the followings in upstream (fuel)
+ for node in $CONTROLLER_IPS;do
+ echo "check controller configuration for doctor ($node)"
+ ssh $ssh_opts_cpu "root@$node" '
+ set -x
+ date
+ echo "### apply patches (installer=fuel)"
+
+ ep_conf=/etc/ceilometer/event_pipeline.yaml
+ entry="- notifier://?topic=alarm.all"
+ if ! grep -q -e "$entry" $ep_conf; then
+ echo "modify the ceilometer config"
+ echo " $entry # added by doctor script" >> $ep_conf
+ service ceilometer-agent-notification restart
+ fi
+
+ # TODO(r-mibu): enable this section once congress 4.0.0 is available
+ if false; then
+ co_conf=/etc/congress/congress.conf
+ entry="congress.datasources.doctor_driver.DoctorDriver"
+ if ! grep -q -e "^drivers.*$entry" $co_conf; then
+ echo "modify the congress config"
+ sed -i -e "/^drivers/s/$/,$entry # added by doctor script/" \
+ $co_conf
+ service congress-server restart
+ fi
+
+ rule="-m multiport -p tcp --dports 1789"
+ rule+=" -m comment --comment doctor-congress"
+ rule+=" -j ACCEPT"
+ if ! iptables -C INPUT $rule; then
+ iptables -I INPUT $rule
+ fi
+
+ ha_conf=/etc/haproxy/conf.d/180-congress.cfg
+ if [[ ! -e $ha_conf ]]; then
+ sed -e "1i# generated by doctor script" \
+ -e "s/9696/1789/" \
+ -e "s/neutron/congress/" \
+ /etc/haproxy/conf.d/085-neutron.cfg > $ha_conf
+ 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