Make compass work on both remote and local install.
Change-Id: I7a9b03bcf5fa6e2a4686a4e2a68dbcc2654cb93d
This commit is contained in:
		@@ -1,22 +1,3 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -e
 | 
			
		||||
# systemctl restart mysql.service
 | 
			
		||||
# systemctl status mysql.service || exit $?
 | 
			
		||||
# /opt/compass/bin/manage_db.py createdb
 | 
			
		||||
/opt/compass/bin/clean_installers.py --noasync
 | 
			
		||||
/opt/compass/bin/clean_installation_logs.py
 | 
			
		||||
rm -rf /var/ansible/run/*
 | 
			
		||||
# systemctl restart httpd.service
 | 
			
		||||
# systemctl status httpd.service || exit $?
 | 
			
		||||
systemctl restart rsyslog.service
 | 
			
		||||
systemctl status rsyslog.service || exit $?
 | 
			
		||||
systemctl restart redis.service
 | 
			
		||||
systemctl status  redis.service || exit $?
 | 
			
		||||
redis-cli flushall
 | 
			
		||||
systemctl restart cobblerd.service
 | 
			
		||||
systemctl status cobblerd.service || exit $?
 | 
			
		||||
systemctl restart compass-celeryd.service
 | 
			
		||||
systemctl status compass-celeryd.service || exit $?
 | 
			
		||||
# systemctl restart compass-progress-updated.service
 | 
			
		||||
# systemctl status compass-progress-updated.service || exit $?
 | 
			
		||||
 | 
			
		||||
/opt/compass/bin/refresh_agent.sh
 | 
			
		||||
/opt/compass/bin/refresh_server.sh
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								bin/refresh_agent.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								bin/refresh_agent.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -e
 | 
			
		||||
# systemctl restart mysql.service
 | 
			
		||||
# systemctl status mysql.service || exit $?
 | 
			
		||||
# /opt/compass/bin/manage_db.py createdb
 | 
			
		||||
/opt/compass/bin/clean_installers.py --noasync
 | 
			
		||||
/opt/compass/bin/clean_installation_logs.py
 | 
			
		||||
rm -rf /var/ansible/run/*
 | 
			
		||||
# systemctl restart httpd.service
 | 
			
		||||
# systemctl status httpd.service || exit $?
 | 
			
		||||
systemctl restart rsyslog.service
 | 
			
		||||
systemctl status rsyslog.service || exit $?
 | 
			
		||||
systemctl restart redis.service
 | 
			
		||||
systemctl status  redis.service || exit $?
 | 
			
		||||
redis-cli flushall
 | 
			
		||||
systemctl restart cobblerd.service
 | 
			
		||||
systemctl status cobblerd.service || exit $?
 | 
			
		||||
systemctl restart compass-celeryd.service
 | 
			
		||||
systemctl status compass-celeryd.service || exit $?
 | 
			
		||||
# systemctl restart compass-progress-updated.service
 | 
			
		||||
# systemctl status compass-progress-updated.service || exit $?
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										22
									
								
								bin/refresh_server.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								bin/refresh_server.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -e
 | 
			
		||||
systemctl restart mysql.service
 | 
			
		||||
systemctl status mysql.service || exit $?
 | 
			
		||||
/opt/compass/bin/manage_db.py createdb
 | 
			
		||||
# /opt/compass/bin/clean_installers.py --noasync
 | 
			
		||||
# /opt/compass/bin/clean_installation_logs.py
 | 
			
		||||
# rm -rf /var/ansible/run/*
 | 
			
		||||
systemctl restart httpd.service
 | 
			
		||||
systemctl status httpd.service || exit $?
 | 
			
		||||
systemctl restart rsyslog.service
 | 
			
		||||
systemctl status rsyslog.service || exit $?
 | 
			
		||||
systemctl restart redis.service
 | 
			
		||||
systemctl status  redis.service || exit $?
 | 
			
		||||
redis-cli flushall
 | 
			
		||||
# systemctl restart cobblerd.service
 | 
			
		||||
# systemctl status cobblerd.service || exit $?
 | 
			
		||||
# systemctl restart compass-celeryd.service
 | 
			
		||||
# systemctl status compass-celeryd.service || exit $?
 | 
			
		||||
# systemctl restart compass-progress-updated.service
 | 
			
		||||
# systemctl status compass-progress-updated.service || exit $?
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								conf/celeryconfig_local
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								conf/celeryconfig_local
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
## Celery related setting: this is the default setting
 | 
			
		||||
 | 
			
		||||
CELERY_RESULT_BACKEND ="amqp://"
 | 
			
		||||
BROKER_URL = "amqp://guest:guest@localhost:5672//"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CELERY_IMPORTS=("compass.tasks.tasks",)
 | 
			
		||||
CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
 | 
			
		||||
C_FORCE_ROOT = 1
 | 
			
		||||
CELERY_DEFAULT_QUEUE = 'admin@huawei.com'
 | 
			
		||||
CELERY_DEFAULT_EXCHANGE = 'admin@huawei.com'
 | 
			
		||||
CELERY_DEFAULT_ROUTING_KEY = 'admin@huawei.com'
 | 
			
		||||
@@ -42,6 +42,11 @@ sudo ln -s -f /opt/compass/bin/compass_wsgi.py /var/www/compass/compass.wsgi
 | 
			
		||||
sudo cp -rf $COMPASSDIR/bin/chef/* /opt/compass/bin/
 | 
			
		||||
sudo cp -rf $COMPASSDIR/bin/cobbler/* /opt/compass/bin/
 | 
			
		||||
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "false" ]; then
 | 
			
		||||
    sudo rm -rf /opt/compass/bin/refresh.sh
 | 
			
		||||
    sudo rm -rf /opt/compass/bin/refresh_server.sh
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ $SUPPORT_CENTOS_7_2 != "y" ]]; then
 | 
			
		||||
    sudo rm -f /etc/compass/os/centos7.0.conf
 | 
			
		||||
fi
 | 
			
		||||
@@ -88,6 +93,9 @@ sudo sed -i "s/\$hostname/$HOSTNAME/g" /etc/compass/setting
 | 
			
		||||
sudo sed -i "s/\$gateway/$OPTION_ROUTER/g" /etc/compass/setting
 | 
			
		||||
domains=$(echo $NAMESERVER_DOMAINS | sed "s/,/','/g")
 | 
			
		||||
sudo sed -i "s/\$domains/$domains/g" /etc/compass/setting
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true" ]; then
 | 
			
		||||
    sudo sed -i "/DATABASE_SERVER =/c\DATABASE_SERVER = '127.0.0.1:3306'" /etc/compass/setting
 | 
			
		||||
fi 
 | 
			
		||||
 | 
			
		||||
sudo sed -i "s/\$cobbler_ip/$IPADDR/g" /etc/compass/os_installer/cobbler.conf
 | 
			
		||||
#sudo sed -i "s/\$chef_ip/$IPADDR/g" /etc/compass/package_installer/chef-icehouse.conf
 | 
			
		||||
@@ -120,17 +128,26 @@ else
 | 
			
		||||
    echo "redis is not running"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
wget -O /tmp/aws_credentials "http://www.stack360.io/aws_credentials"
 | 
			
		||||
filename='/tmp/aws_credentials'
 | 
			
		||||
id=$(sed -n '1p' < $filename)
 | 
			
		||||
key=$(sed -n '2p' < $filename)
 | 
			
		||||
sudo sed -i "s~ACCESS_ID~$id~g" /etc/compass/celeryconfig
 | 
			
		||||
sudo sed -i "s~ACCESS_KEY~$key~g" /etc/compass/celeryconfig
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true" ]; then
 | 
			
		||||
    sudo mv /etc/compass/celeryconfig_local /etc/compass/celeryconfig
 | 
			
		||||
else
 | 
			
		||||
    sudo mv /etc/compass/celeryconfig_remote /etc/compass/celeryconfig
 | 
			
		||||
    wget -O /tmp/aws_credentials "http://www.stack360.io/aws_credentials"
 | 
			
		||||
    filename='/tmp/aws_credentials'
 | 
			
		||||
    id=$(sed -n '1p' < $filename)
 | 
			
		||||
    key=$(sed -n '2p' < $filename)
 | 
			
		||||
    sudo sed -i "s~ACCESS_ID~$id~g" /etc/compass/celeryconfig
 | 
			
		||||
    sudo sed -i "s~ACCESS_KEY~$key~g" /etc/compass/celeryconfig
 | 
			
		||||
fi
 | 
			
		||||
sudo systemctl enable compass-progress-updated.service
 | 
			
		||||
sudo systemctl enable compass-celeryd.service
 | 
			
		||||
 | 
			
		||||
/opt/compass/bin/refresh.sh
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true" ]; then
 | 
			
		||||
    /opt/compass/bin/refresh.sh
 | 
			
		||||
else
 | 
			
		||||
    /opt/compass/bin/refresh_agent.sh
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "$?" != "0" ]]; then
 | 
			
		||||
    echo "failed to refresh compassd service"
 | 
			
		||||
    exit 1
 | 
			
		||||
@@ -154,11 +171,22 @@ else
 | 
			
		||||
    echo "redis has already started"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# sudo systemctl status mysql.service |grep running
 | 
			
		||||
# if [[ "$?" != "0" ]]; then
 | 
			
		||||
#     echo "mysqld is not started"
 | 
			
		||||
#     exit 1
 | 
			
		||||
# fi
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true" ]; then
 | 
			
		||||
sudo systemctl status mysql.service |grep running
 | 
			
		||||
if [[ "$?" != "0" ]]; then
 | 
			
		||||
    echo "mysqld is not started"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#sudo systemctl status compass-progress-updated.service |grep running
 | 
			
		||||
#if [[ "$?" != "0" ]]; then
 | 
			
		||||
#    echo "compass-progress-updated is not started"
 | 
			
		||||
#    exit 1
 | 
			
		||||
#else
 | 
			
		||||
#    echo "compass-progress-updated has already started"
 | 
			
		||||
#fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sudo systemctl status compass-celeryd.service |grep running
 | 
			
		||||
if [[ "$?" != "0" ]]; then
 | 
			
		||||
@@ -168,14 +196,6 @@ else
 | 
			
		||||
    echo "compass-celeryd has already started"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# sudo systemctl status compass-progress-updated.service |grep running
 | 
			
		||||
# if [[ "$?" != "0" ]]; then
 | 
			
		||||
#    echo "compass-progress-updated is not started"
 | 
			
		||||
#    exit 1
 | 
			
		||||
#else
 | 
			
		||||
#    echo "compass-progress-updated has already started"
 | 
			
		||||
#fi
 | 
			
		||||
 | 
			
		||||
sleep 10
 | 
			
		||||
#compass check
 | 
			
		||||
#if [[ "$?" != "0" ]]; then
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								install/env.conf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								install/env.conf
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
NIC=${NIC:-eth1}
 | 
			
		||||
IPADDR=${IPADDR:-10.1.10.15}
 | 
			
		||||
NETMASK=${NETMASK:-255.255.255.0}
 | 
			
		||||
WEB_SOURCE=${WEB_SOURCE:-http://git.openstack.org/openstack/compass-web}
 | 
			
		||||
ADAPTERS_SOURCE=${ADAPTERS_SOURCE:-https://gerrit.opnfv.org/gerrit/compass4nfv}
 | 
			
		||||
OPTION_ROUTER=${OPTION_ROUTER:-10.1.10.15}
 | 
			
		||||
NAMESERVER_DOMAINS=${NAMESERVER_DOMAINS:-ods.com}
 | 
			
		||||
NAMESERVER_REVERSE_ZONES=${NAMESERVER_REVERSE_ZONES:-unused}
 | 
			
		||||
NEXTSERVER=${NEXTSERVER:-10.1.10.15}
 | 
			
		||||
IP_START=${IP_START:-10.1.10.100}
 | 
			
		||||
IP_END=${IP_END:-10.1.10.200}
 | 
			
		||||
LOCAL_REPO=${LOCAL_REPO:-}
 | 
			
		||||
SUPPORT_CENTOS_7_2=${SUPPORT_CENTOS_7_2:-}
 | 
			
		||||
SUPPORT_UBUNTU_14_04_03=${SUPPORT_UBUNTU_14_04_03:-}
 | 
			
		||||
@@ -2,9 +2,11 @@
 | 
			
		||||
# Config File for Compass Installer #
 | 
			
		||||
#####################################
 | 
			
		||||
# Agent or Fullserver
 | 
			
		||||
export FULL_COMPASS_SERVER="false"
 | 
			
		||||
export FULL_COMPASS_SERVER="true"
 | 
			
		||||
# User Email
 | 
			
		||||
export USER_EMAIL="lab@huawei.com"
 | 
			
		||||
export USER_EMAIL="test@huawei.com"
 | 
			
		||||
# User Password
 | 
			
		||||
export USER_PASSWORD=
 | 
			
		||||
# OS_INSTALLER indicates the tool for OS provisioning, default is 'cobbler'.
 | 
			
		||||
export OS_INSTALLER="cobbler"
 | 
			
		||||
 | 
			
		||||
@@ -33,17 +35,17 @@ export PUBLIC_GATEWAY=
 | 
			
		||||
 | 
			
		||||
# Install network config, it is a private network
 | 
			
		||||
export NIC="eth1"
 | 
			
		||||
export IPADDR="10.1.0.15"
 | 
			
		||||
export IPADDR="10.1.10.15"
 | 
			
		||||
export NETMASK="255.255.255.0"
 | 
			
		||||
 | 
			
		||||
# DHCP config for install network
 | 
			
		||||
# DHCP option router  address(Default is your management interface IP address )"
 | 
			
		||||
export OPTION_ROUTER="10.1.0.15"
 | 
			
		||||
export OPTION_ROUTER="10.1.10.15"
 | 
			
		||||
# The IP range for DHCP clients (Default: local subnet start from 100 to 254)
 | 
			
		||||
export IP_START="10.1.0.100"
 | 
			
		||||
export IP_END="10.1.0.200"
 | 
			
		||||
export IP_START="10.1.10.100"
 | 
			
		||||
export IP_END="10.1.10.200"
 | 
			
		||||
# TFTP server's IP address(Default: Management Interface/eth0 IP)
 | 
			
		||||
export NEXTSERVER="10.1.0.15"
 | 
			
		||||
export NEXTSERVER="10.1.10.15"
 | 
			
		||||
 | 
			
		||||
# The machines MAC list. it must be filled, any space or null is wrong in quotes:
 | 
			
		||||
export switch_IP="127.0.0.1"
 | 
			
		||||
 
 | 
			
		||||
@@ -346,7 +346,7 @@ source ${COMPASSDIR}/install/ansible.sh || exit $?
 | 
			
		||||
echo "Install log agent."
 | 
			
		||||
source ${COMPASSDIR}/install/logstash-forwarder.sh || exit $?
 | 
			
		||||
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true"]; then
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true" ]; then
 | 
			
		||||
    echo "Download and install Compass Web"
 | 
			
		||||
    source ${COMPASSDIR}/install/compass_web.sh || exit $?
 | 
			
		||||
fi
 | 
			
		||||
@@ -357,7 +357,7 @@ source ${COMPASSDIR}/install/compass.sh || exit $?
 | 
			
		||||
figlet -ctf slant Installation Complete!
 | 
			
		||||
echo -e "It takes\x1b[32m $SECONDS \x1b[0mseconds during the installation."
 | 
			
		||||
 | 
			
		||||
if [[ "${FULL_COMPASS_SERVER}" == "false" ]]; then
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "false" ]; then
 | 
			
		||||
    machine_list_conf="MACHINE_LIST = [ { '${switch_IP}': [ "
 | 
			
		||||
    for host in ${PXE_MACs[@]}; do
 | 
			
		||||
        port=$(echo ${host} | awk -F , '{print $1}' | awk -F = '{print $2}')
 | 
			
		||||
@@ -375,31 +375,34 @@ if [[ "${FULL_COMPASS_SERVER}" == "false" ]]; then
 | 
			
		||||
#    rm -rf /var/ansible/openstack_mitaka/HA-ansible-multinodes.yml 2>/dev/null
 | 
			
		||||
#    cp ${COMPASSDIR}/misc/adapter_changes/HA-ansible-multinodes.yml /var/ansible/openstack_mitaka/
 | 
			
		||||
    rm -rf /var/lib/cobbler/snippets/preseed_post_anamon 2>/dev/null
 | 
			
		||||
    cp ${COMPASSDIR}/misc/adapter_changes/preseed_post_anamon /var/lib/cobbler/snippets/
 | 
			
		||||
 | 
			
		||||
    sed -i 's/^CELERY_DEFAULT_QUEUE.*/CELERY_DEFAULT_QUEUE = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
    sed -i 's/^CELERY_DEFAULT_EXCHANGE.*/CELERY_DEFAULT_EXCHANGE = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
    sed -i 's/^CELERY_DEFAULT_ROUTING_KEY.*/CELERY_DEFAULT_ROUTING_KEY = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
 | 
			
		||||
    # Restart services
 | 
			
		||||
    systemctl restart httpd.service
 | 
			
		||||
    sleep 10
 | 
			
		||||
    echo "Checking if httpd is running"
 | 
			
		||||
    sudo systemctl status httpd.service
 | 
			
		||||
    if [[ "$?" == "0" ]]; then
 | 
			
		||||
        echo "httpd is running"
 | 
			
		||||
    else
 | 
			
		||||
        echo "httpd is not running"
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    systemctl restart compass-celeryd.service
 | 
			
		||||
    echo "Checking if httpd is running"
 | 
			
		||||
    sudo systemctl status compass-celeryd.service
 | 
			
		||||
    if [[ "$?" == "0" ]]; then
 | 
			
		||||
        echo "celeryd is running"
 | 
			
		||||
    else
 | 
			
		||||
        echo "celeryd is not running"
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
    cp ${COMPASSDIR}/misc/adapter_changes/preseed_post_anamon_remote /var/lib/cobbler/snippets/preseed_post_anamon
 | 
			
		||||
else
 | 
			
		||||
    rm -rf /var/lib/cobbler/snippets/preseed_post_anamon 2>/dev/null
 | 
			
		||||
    cp ${COMPASSDIR}/misc/adapter_changes/preseed_post_anamon_local /var/lib/cobbler/snippets/preseed_post_anamon
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# sudo sed -i 's/^CELERY_DEFAULT_QUEUE.*/CELERY_DEFAULT_QUEUE = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
# sudo sed -i 's/^CELERY_DEFAULT_EXCHANGE.*/CELERY_DEFAULT_EXCHANGE = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
# sudo sed -i 's/^CELERY_DEFAULT_ROUTING_KEY.*/CELERY_DEFAULT_ROUTING_KEY = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
 | 
			
		||||
# Restart services
 | 
			
		||||
systemctl restart httpd.service
 | 
			
		||||
sleep 10
 | 
			
		||||
echo "Checking if httpd is running"
 | 
			
		||||
sudo systemctl status httpd.service
 | 
			
		||||
if [[ "$?" == "0" ]]; then
 | 
			
		||||
    echo "httpd is running"
 | 
			
		||||
else
 | 
			
		||||
    echo "httpd is not running"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
systemctl restart compass-celeryd.service
 | 
			
		||||
echo "Checking if httpd is running"
 | 
			
		||||
sudo systemctl status compass-celeryd.service
 | 
			
		||||
if [[ "$?" == "0" ]]; then
 | 
			
		||||
    echo "celeryd is running"
 | 
			
		||||
else
 | 
			
		||||
    echo "celeryd is not running"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -104,7 +104,7 @@ else
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#update mysqld
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true"]; then
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true" ]; then
 | 
			
		||||
    echo "update mysqld"
 | 
			
		||||
    mkdir -p /var/log/mysql
 | 
			
		||||
    chmod -R 777 /var/log/mysql
 | 
			
		||||
 
 | 
			
		||||
@@ -6,15 +6,19 @@ source install.conf
 | 
			
		||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 | 
			
		||||
echo "The email address you use to register is ${USER_EMAIL}"
 | 
			
		||||
password=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6`
 | 
			
		||||
data=`echo "{\"email\":\"${USER_EMAIL}\",\"password\":\"${password}\"}"`
 | 
			
		||||
wget -O /tmp/user_info --post-data=$data --header=Content-Type:application/json "http://www.stack360.io/api/users/register"
 | 
			
		||||
 | 
			
		||||
USER_PASSWORD="${USER_PASSWORD:-$password}"
 | 
			
		||||
data=`echo "{\"email\":\"${USER_EMAIL}\",\"password\":\"${USER_PASSWORD}\"}"`
 | 
			
		||||
COMPASS_API_SERVER="c.stack360.io"
 | 
			
		||||
if [ "$FULL_COMPASS_SERVER" == "true" ]; then
 | 
			
		||||
    COMPASS_API_SERVER="127.0.0.1"
 | 
			
		||||
fi
 | 
			
		||||
wget -O /tmp/user_info --post-data=$data --header=Content-Type:application/json "http://$COMPASS_API_SERVER/api/users/register"
 | 
			
		||||
if [ $? -ne 0 ]; then
 | 
			
		||||
echo "Register failed"
 | 
			
		||||
exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "Register suceeded, your password is $password, please remember your password at all times."
 | 
			
		||||
echo "Register suceeded, your password is $USER_PASSWORD, please remember your password at all times."
 | 
			
		||||
sudo sed -i 's/^CELERY_DEFAULT_QUEUE.*/CELERY_DEFAULT_QUEUE = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
sudo sed -i 's/^CELERY_DEFAULT_EXCHANGE.*/CELERY_DEFAULT_EXCHANGE = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
sudo sed -i 's/^CELERY_DEFAULT_ROUTING_KEY.*/CELERY_DEFAULT_ROUTING_KEY = \"'"${USER_EMAIL}"'\"/g' /etc/compass/celeryconfig
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										80
									
								
								misc/adapter_changes/preseed_post_anamon_local
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								misc/adapter_changes/preseed_post_anamon_local
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,80 @@
 | 
			
		||||
#if $str($getVar('anamon_enabled','')) == "1"
 | 
			
		||||
 | 
			
		||||
## install anamon script
 | 
			
		||||
    #if $getVar("compass_server", "") != ""
 | 
			
		||||
wget -O /usr/local/sbin/anamon "http://$compass_server:$http_port/cobbler/aux/anamon"
 | 
			
		||||
    #else
 | 
			
		||||
wget -O /usr/local/sbin/anamon "http://$server:$http_port/cobbler/aux/anamon"
 | 
			
		||||
    #end if
 | 
			
		||||
## install anamon system service
 | 
			
		||||
cat << EOF > /etc/init.d/anamon.init
 | 
			
		||||
#raw
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
## BEGIN INIT INFO
 | 
			
		||||
# Provides: anamon.init
 | 
			
		||||
# Default-Start: 3 5
 | 
			
		||||
# Default-Stop: 0 1 2 4 6
 | 
			
		||||
# Required-Start: $network
 | 
			
		||||
# Short-Description: Starts the cobbler anamon boot notification program
 | 
			
		||||
# Description: anamon runs the first time a machine is booted after
 | 
			
		||||
#              installation.
 | 
			
		||||
## END INIT INFO
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# anamon.init: Starts the cobbler post-install boot notification program
 | 
			
		||||
#
 | 
			
		||||
# chkconfig: 35 95 95
 | 
			
		||||
#
 | 
			
		||||
# description: anamon runs the first time a machine is booted after
 | 
			
		||||
#              installation.
 | 
			
		||||
#
 | 
			
		||||
#end raw
 | 
			
		||||
cd /var/log/installer
 | 
			
		||||
gunzip initial-status.gz
 | 
			
		||||
cd -
 | 
			
		||||
#if $getVar("compass_server","") != ""
 | 
			
		||||
/usr/local/sbin/anamon --watchfile "/var/log/installer/syslog /var/log/installer/hardware-summary /var/log/installer/initial-status /var/log/installer/status" --name $name --server $compass_server --port $http_port --exit
 | 
			
		||||
#else
 | 
			
		||||
/usr/local/sbin/anamon --watchfile "/var/log/installer/syslog /var/log/installer/hardware-summary /var/log/installer/initial-status /var/log/installer/status" --name $name --server $server --port $http_port --exit
 | 
			
		||||
#end if
 | 
			
		||||
update-rc.d -f anamon remove
 | 
			
		||||
mv /etc/init.d/anamon.init /tmp/anamon.init
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
## adjust permissions
 | 
			
		||||
chmod 755 /etc/init.d/anamon.init /usr/local/sbin/anamon
 | 
			
		||||
test -d /selinux && restorecon /etc/init.d/anamon.init /usr/local/sbin/anamon
 | 
			
		||||
 | 
			
		||||
## enable the script
 | 
			
		||||
update-rc.d anamon.init defaults 95 95
 | 
			
		||||
#end if
 | 
			
		||||
 | 
			
		||||
## place start-up script for updating os state
 | 
			
		||||
#if $getVar('compass_server', '') != ""
 | 
			
		||||
    #set srv = $getVar('compass_server','')
 | 
			
		||||
#else
 | 
			
		||||
    #set srv = $getVar('server','')
 | 
			
		||||
#end if
 | 
			
		||||
cat << EOF > /etc/init.d/set_state
 | 
			
		||||
#raw
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
# Provides: set_state
 | 
			
		||||
# Default-Start: 3 5
 | 
			
		||||
# Default-Stop: 0 1 2 4 6
 | 
			
		||||
# Required-Start: $network $ssh
 | 
			
		||||
# Short-Description: Notifies the os installation is finished
 | 
			
		||||
# Description: set_state runs the first time a machine is booted after
 | 
			
		||||
#              installation.
 | 
			
		||||
#end raw
 | 
			
		||||
wget -O /tmp/os_state --post-data='{"ready": true}' --header=Content-Type:application/json "http://$srv/api/hosts/${host_id}/state_internal"
 | 
			
		||||
update-rc.d -f set_state remove
 | 
			
		||||
mv /etc/init.d/set_state /tmp/set_state
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
## adjust permissions
 | 
			
		||||
chmod 755 /etc/init.d/set_state
 | 
			
		||||
test -d /selinux && restorecon /etc/init.d/set_state
 | 
			
		||||
 | 
			
		||||
update-rc.d set_state defaults 99 99
 | 
			
		||||
 | 
			
		||||
echo "compass_server=$server" >> /etc/compass.conf
 | 
			
		||||
		Reference in New Issue
	
	Block a user