From b91d6cd875de25ca9f984d9ce6f1f10654b86c81 Mon Sep 17 00:00:00 2001 From: jjhua Date: Mon, 11 Nov 2013 13:46:27 -0500 Subject: [PATCH 1/3] clean the chef-server data and stop the chef-server before uninstall the chef-server --- xCAT/postscripts/install_chef_server | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/install_chef_server b/xCAT/postscripts/install_chef_server index 2a1728678..7af79efa4 100755 --- a/xCAT/postscripts/install_chef_server +++ b/xCAT/postscripts/install_chef_server @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh # IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html ##################################################### #=head1 install_chef_server @@ -50,10 +50,16 @@ fi if [ "$os" == "ubuntu" ]; then #remove the old chef-server and the configuration files + HOME='/root/' + export HOME + /usr/bin/chef-server-ctl cleanse > /dev/null 2>&1 + /usr/bin/chef-server-ctl stop > /dev/null 2>&1 + /usr/bin/chef-server-ctl status > /dev/null 2>&1 apt-get -y autoremove --purge chef-server rm -rf /etc/chef-server rm -rf /etc/chef rm -rf /root/.chef + rm -rf /opt/chef-server/ #add the internet Ubuntu repositories #urelease="precise" #default release name From 5669c23ff1bced3469ffa293fccd03e42b4ae049 Mon Sep 17 00:00:00 2001 From: jjhua Date: Mon, 11 Nov 2013 14:46:37 -0500 Subject: [PATCH 2/3] remove the -vx flag --- xCAT/postscripts/mountinstall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/mountinstall b/xCAT/postscripts/mountinstall index 62097e469..63b57c29a 100755 --- a/xCAT/postscripts/mountinstall +++ b/xCAT/postscripts/mountinstall @@ -1,4 +1,4 @@ -#!/bin/sh -vx +#!/bin/sh # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html # This script, ("mountinstall"), is a sample xCAT post script for From b9ef6a4282fb7eebbde0cfb44a4aa217480e539d Mon Sep 17 00:00:00 2001 From: jjhua Date: Mon, 11 Nov 2013 16:11:18 -0500 Subject: [PATCH 3/3] fixed bug 3888 initialize the variable uselocalhost; add new script configgw to configure the public gw --- xCAT-OpenStack/postscripts/configgw | 67 ++++++++++++++++++++++++ xCAT/postscripts/config_chef_workstation | 1 + 2 files changed, 68 insertions(+) create mode 100755 xCAT-OpenStack/postscripts/configgw diff --git a/xCAT-OpenStack/postscripts/configgw b/xCAT-OpenStack/postscripts/configgw new file mode 100755 index 000000000..36c246eaf --- /dev/null +++ b/xCAT-OpenStack/postscripts/configgw @@ -0,0 +1,67 @@ +#!/bin/bash + +str_dir_name=`dirname $0` +. $str_dir_name/xcatlib.sh + +if [ -z "$1" ];then + echo "$0 need the interface name." + exit +fi + +str_nic_name=$1 +str_ip_mask=`ip addr show dev $str_nic_name | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1` + +str_ip=`echo $str_ip_mask | awk -F'/' '{print $1}'` +str_mask=`echo $str_ip_mask | awk -F'/' '{print $2}'` + +str_net=$(v4calcnet $str_ip $str_mask) + +num_i=1 +while [ $num_i -le $NETWORKS_LINES ];do + eval str_temp=\$NETWORKS_LINE$num_i + str_net_table=`echo $str_temp | awk -F'net=' '{print $2}' | awk -F'|' '{print $1}'` + + if [ "$str_net" = "$str_net_table" ];then + str_gateway=`echo $str_temp | awk -F'gateway=' '{print $2}' | awk -F'|' '{print $1}' | sed 's:^/::'` + fi + num_i=$((num_i+1)) +done + +if [ -z "$str_gateway" ];then + echo "Can not find the corresponding network defination" + exit +fi + +echo $str_gateway | grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' > /dev/null +if [ $? -ne 0 ];then + echo "The gateway must be ipv4 address: $str_gateway" + exit +fi + +#change the default route +route del default +route add default gw $str_gateway dev $str_nic_name + +#change the gateway persistent +if [ -f "/etc/debian_version" ];then + debianpreconf + #delete the gateway from all configuration files + sed -i "s/.*gateway.*//" /etc/network/interfaces.d/* + + str_conf_file="/etc/network/interfaces.d/$str_nic_name" + echo " gateway $str_gateway --" >> $str_conf_file +elif [ -f "/etc/SuSE-release" ];then + grep -i "default" /etc/sysconfig/network/routes + if [ $? -eq 0 ];then + sed -i "s/.*default.*/default ${str_gateway} - -/i" /etc/sysconfig/network/routes + else + echo "default ${str_gateway} - -" >> /etc/sysconfig/network/routes + fi +else + grep -i "GATEWAY" /etc/sysconfig/network + if [ $? -eq 0 ];then + sed -i "s/.*GATEWAY.*/GATEWAY=${str_gateway}/i" /etc/sysconfig/network + else + echo "GATEWAY=${str_gateway}" >> /etc/sysconfig/network + fi +fi diff --git a/xCAT/postscripts/config_chef_workstation b/xCAT/postscripts/config_chef_workstation index 23c104acc..5adbf68c8 100755 --- a/xCAT/postscripts/config_chef_workstation +++ b/xCAT/postscripts/config_chef_workstation @@ -11,6 +11,7 @@ node=`hostname` +uselocalhost=0 # Who is the chef server? # -s takes precedence # then site.chefserver