Files
trove-integration/scripts/files/bootstrap_init-mysql.sh
Sushil Kumar 75a9986411 Starts trove-guest if /etc/trove exists
Reasons:
- When provisioning a guest using heat code-path, the guest agent shows
  errors in first-boot.d.log, which is because first-boot tries to start
  trove-guest service before /etc/guest_info file is created by heat
  provisioning.

Changes:
- Adds condition to start trove-guest, to check existence of
  /etc/guest_info, if file exists, then start trove-guest.

Change-Id: I112822fa69b2d4a49d29457fa4b1acf06206c52e
Closes-Bug: #1278733
2014-02-27 06:56:02 +00:00

36 lines
1.4 KiB
Bash

#!/usr/bin/env bash
# Adds user to the sudoers file so they can do everything w/o a pass
# Some binaries might be under /sbin or /usr/sbin, so make sure sudo will
# see them by forcing PATH
host_name=`hostname`
echo "127.0.0.1 ${host_name}" >> /etc/hosts
TEMPFILE=`mktemp`
echo "GUEST_USERNAME ALL=(ALL) NOPASSWD:ALL" > $TEMPFILE
chmod 0440 $TEMPFILE
sudo chown root:root $TEMPFILE
sudo mv $TEMPFILE /etc/sudoers.d/60_trove_guest
# Some installs have issues with the user homedir
sudo chown GUEST_USERNAME /home/GUEST_USERNAME
# Copies all the trove code to the guest image
sudo -u GUEST_USERNAME rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -avz --exclude='.*' HOST_USERNAME@NETWORK_GATEWAY:PATH_TROVE/ /home/GUEST_USERNAME/trove
# Do an apt-get update since its SUPER slow first time
if [ -f /etc/debian_version ] ; then
apt-get update
# Disable AppArmor so that trove guestagent can change the conf
# TODO this should probably be done in the guest and then re-enabled install
ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
fi
# Starts the trove guestagent using the upstart script.
# If /etc/guest_info does not exist, this a HEAT deployment, so
# UserData/cfn-init will handle starting the service.
if [ -f /etc/guest_info ] ; then
service trove-guest start
fi