Trove guestagent should not use sample conf

Fixed the trove guestagent to use the config file from
/etc/trove/trove-guestagent.conf instead of using the sample
conf from the trove/etc directory.

Closes-bug: 1176102
Change-Id: I7c55198d6d93f5e909c3b3d9085c08d88561f376
This commit is contained in:
Nikhil Manchanda 2014-04-17 18:08:00 -07:00
parent 7f7c40289d
commit fd1c113d05
3 changed files with 26 additions and 11 deletions

View File

@ -8,11 +8,17 @@ Type=simple
User=GUEST_USERNAME
Group=GUEST_USERNAME
# If /etc/trove-installed does not exist, copy the trove source from
# the user's development environment, then touch the sentinel file
ExecStartPre=mkdir -p GUEST_LOGDIR ; chown GUEST_USERNAME:root GUEST_LOGDIR ; /bin/bash "test -f /home/GUEST_USERNAME/trove-installed || 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 && touch /home/GUEST_USERNAME/trove-installed"
ExecStartPre=mkdir -p GUEST_LOGDIR ; chown GUEST_USERNAME:root GUEST_LOGDIR
ExecStart=/home/GUEST_USERNAME/trove/bin/trove-guestagent --config-file=/etc/guest_info --config-file=/home/GUEST_USERNAME/trove/etc/trove/trove-guestagent.conf.sample
# If ~/trove-installed does not exist, copy the trove source from
# the user's development environment, then touch the sentinel file
ExecStartPre=/bin/bash "test -f /home/GUEST_USERNAME/trove-installed || 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 && touch /home/GUEST_USERNAME/trove-installed"
# If /etc/trove does not exist, create it and then copy the trove-guestagent.conf
# from /etc/trove on the user's development environment,
ExecStartPre=/bin/bash "test -d /etc/trove || sudo mkdir -p /etc/trove && sudo -u GUEST_USERNAME rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -avz --exclude='.*' HOST_USERNAME@NETWORK_GATEWAY:/etc/trove/trove-guestagent.conf ~GUEST_USERNAME/ && mv ~GUEST_USERNAME/trove-guestagent.conf /etc/trove/trove-guestagent.conf"
ExecStart=/home/GUEST_USERNAME/trove/bin/trove-guestagent --config-file=/etc/guest_info --config-file=/etc/trove/trove-guestagent.conf
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

View File

@ -15,10 +15,15 @@ pre-start script
chown GUEST_USERNAME:root GUEST_LOGDIR
chmod +r /etc/guest_info
# If /etc/trove-installed does not exist, copy the trove source from
# the user's development environment, then touch the sentinel file
test -f /home/GUEST_USERNAME/trove-installed || 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 && touch /home/GUEST_USERNAME/trove-installed
# If /etc/trove does not exist, copy the trove source and the
# guest agent config from the user's development environment
if [ ! -d /etc/trove ]; then
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
mkdir -p /etc/trove
sudo -u GUEST_USERNAME rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -avz --exclude='.*' HOST_USERNAME@NETWORK_GATEWAY:/etc/trove/trove-guestagent.conf ~GUEST_USERNAME/
mv ~GUEST_USERNAME/trove-guestagent.conf /etc/trove/trove-guestagent.conf
fi
end script
exec su -c "/home/GUEST_USERNAME/trove/contrib/trove-guestagent --config-file=/etc/guest_info --config-file=/home/GUEST_USERNAME/trove/etc/trove/trove-guestagent.conf.sample" GUEST_USERNAME
exec su -c "/home/GUEST_USERNAME/trove/contrib/trove-guestagent --config-file=/etc/guest_info --config-file=/etc/trove/trove-guestagent.conf" GUEST_USERNAME

View File

@ -390,7 +390,7 @@ function install_test_packages() {
sudo pip install openstack.nose_plugin proboscis pexpect mockito
}
function mod_test_conf() {
function mod_confs() {
cp $REDSTACK_SCRIPTS/conf/test_begin.conf $TROVE_CONF_DIR/test.conf
TROVE_REPORT_DIR=$REDSTACK_SCRIPTS/../report/
EXTRA_CONF=$REDSTACK_SCRIPTS/conf/test.extra.conf
@ -413,6 +413,10 @@ function mod_test_conf() {
sed -i "s/%alt_demo_tenant_id%/$(get_attribute_id tenant alt_demo 1)/g" $TROVE_CONF_DIR/test.conf
sed -i "s/%demo_tenant_id%/$(get_attribute_id tenant demo 1)/g" $TROVE_CONF_DIR/test.conf
sed -i "s/%admin_password%/$ADMIN_PASSWORD/g" $TROVE_CONF_DIR/test.conf
# Create a conf for the guestagent based on the sample
cp $PATH_TROVE/etc/trove/trove-guestagent.conf.sample $TROVE_CONF_DIR/trove-guestagent.conf
sed -i "s/10.0.0.1/$NETWORK_GATEWAY/g" $TROVE_CONF_DIR/trove-guestagent.conf
}
@ -430,8 +434,8 @@ function cmd_test_init() {
exclaim "Installing python test packages."
install_test_packages
exclaim "Modifying test.conf with appropriate values."
mod_test_conf
exclaim "Modifying test.conf and guest.conf with appropriate values."
mod_confs
exclaim "Creating Test Flavors."
add_test_flavors