2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-18 12:20:40 +00:00

log tag support for common scripts (#5743)

* log tag support for common scripts

* enhancements

* typo fixed
This commit is contained in:
Yuan Bai
2018-10-30 16:57:39 +08:00
committed by Bin Xu
parent fe33d7d98f
commit e7176d7093
11 changed files with 179 additions and 149 deletions

View File

@ -198,6 +198,7 @@ run_ps () {
scriptype=\"postscript\"
fi
log_label=\"xcat.deployment.\"\$scriptype
export LOGLABEL=\$log_label
if [ -f \$1 ]; then
msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype start..: \$1\"" \"\$logfile\" \"\$log_label\"
if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then
@ -207,7 +208,7 @@ run_ps () {
bash -x ./\$@ 2>&1
ret_local=\$?
else
./\$@ 2>&1 | logger -t xcat -p debug
./\$@ 2>&1 | logger -t \$log_label -p debug
ret_local=\${PIPESTATUS[0]}
fi
else

View File

@ -9,6 +9,11 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then
. $str_dir_name/nicutils.sh
fi
error_code=0
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
#########################################################################
# ifdown/ifup will not be executed in diskful provision postscripts stage
#########################################################################
@ -367,16 +372,13 @@ else
fi
logger -t xcat -p local4.err "configeth: os type: $str_os_type"
log_info "configeth on $NODE: os type: $str_os_type"
if [ "$1" = "-r" ];then
if [ $# -ne 2 ];then
logger -t xcat -p local4.err "configeth: remove nic, but the nic name is missed"
log_error "configeth on $NODE: remove nic, but the nic name is missed"
exit 1
fi
str_nic_name=$2
logger -t xcat -p local4.err "configeth: remove nic $str_nic_name"
log_info "configeth on $NODE: remove nic $str_nic_name"
if [ "$str_os_type" = "aix" ];then
@ -405,7 +407,6 @@ if [ "$1" = "-r" ];then
chdev -l $str_nic_name -a delalias6=$str_ip_alias6
fi
done
logger -t xcat -p local4.err "configeth run command: chdev -l $str_nic_name -a netaddr='' -a netmask='' -a netaddr6='' -a prefixlen='' -a state=down"
log_info "configeth on $NODE run command: chdev -l $str_nic_name -a netaddr='' -a netmask='' -a netaddr6='' -a prefixlen='' -a state=down"
chdev -l $str_nic_name -a netaddr='' -a netmask='' -a netaddr6='' -a prefixlen='' -a state=down
else
@ -425,7 +426,6 @@ if [ "$1" = "-r" ];then
exit $error_code
elif [ "$1" = "-s" ];then
if [ $# -lt 2 ];then
logger -t xcat -p local4.err "configeth: config install nic, but the nic name is missed"
log_error "configeth on $NODE: config install nic, but the nic name is missed"
exit 1
fi
@ -435,7 +435,6 @@ elif [ "$1" = "-s" ];then
str_inst_gateway=''
str_inst_mtu=''
if [ "$str_os_type" = "aix" ];then
logger -t xcat -p local4.err "configeth: aix does not support -s flag"
log_error "configeth on $NODE: aix does not support -s flag"
exit 1
elif [ -f "/etc/debian_version" ];then
@ -517,7 +516,6 @@ elif [ "$1" = "-s" ];then
str_inst_mac=`ip link show $netdev | grep ether | awk '{print $2}'`
fi
if [ -z "$str_inst_ip" -o -z "$str_inst_mask" ];then
logger -t xcat -p local4.err "configeth: config install nic, can not find the information from lease file, return."
log_info "configeth on $NODE: config install nic, can not find information from dhcp lease file, return."
exit 1
fi
@ -673,7 +671,6 @@ fi
#5. no modification, return directly
#3. on linux modify the configuration files
if [ $# -ne 3 ];then
logger -t xcat -p local4.err "configeth: paramters error currently is $@"
log_error "configeth on $NODE: paramters error currently is $@"
exit 1
fi
@ -690,7 +687,7 @@ else
str_temp=`ip addr show dev $str_nic_name`
fi
logger -t xcat -p local4.err "configeth: old configuration: $str_temp"
logger -t $log_label -p local4.err "configeth: old configuration: $str_temp"
echo "configeth on $NODE: old configuration: $str_temp"
@ -731,7 +728,6 @@ while [ $num_index -le $NETWORKS_LINES ];do
num_index=$((num_index+1))
done
logger -t xcat -p local4.err "configeth: new configuration"
log_info "configeth on $NODE: new configuration"
num_index=0
str_ipv6_gateway=''
@ -740,7 +736,6 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do
str_ip=${array_nic_ips[$num_index]}
str_netname=${array_nic_networks[$num_index]}
if [ ! $str_netname ];then
logger -t xcat -p local4.err "configeth: Network name is not defined on $str_nic_name for $str_ip."
log_error "configeth on $NODE: Network name is not defined on $str_nic_name for $str_ip."
error_code=1
num_index=$((num_index+1))
@ -750,7 +745,6 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do
#find out the network definition
str_line=${array_nic_network_config[$num_index]}
if [ ! $str_line ];then
logger -t xcat -p local4.err "configeth: Network object $str_netname is not defined."
log_error "configeth on $NODE: Network object $str_netname is not defined."
error_code=1
num_index=$((num_index+1))
@ -764,7 +758,6 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do
str_mtu=`echo $str_line | awk -F'mtu=' '{print $2}' | awk -F'|' '{print $1}'`
if [ ! $str_subnet -o ! $str_netmask ];then
logger -t xcat -p local4.err "configeth: subnet or netmask is not defined in network object $str_netname."
log_error "configeth on $NODE: subnet or netmask is not defined in network object $str_netname."
error_code=1
num_index=$((num_index+1))
@ -779,7 +772,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do
if [ $? -eq 0 ];then
str_ipv6_gateway=$str_gateway
fi
logger -t xcat -p local4.err "configeth: $str_ip, $str_subnet, $str_netmask, $str_gateway"
logger -t $log_label -p local4.info "configeth: $str_ip, $str_subnet, $str_netmask, $str_gateway"
echo " $str_ip, $str_subnet, $str_netmask, $str_gateway"
#on linux, call sub rutine to define ipv4 or ipv6 address for the persitent configuration
if [ `echo $str_ip | grep -E '^([0-9]{1,3}\.){3}[0-9]{1,3}$'` ];then
@ -796,7 +789,6 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do
hashset hash_new_config "${str_ip}_${str_netmask}" "new"
str_ip_mask_pair=$str_ip_mask_pair"${str_ip}_${str_netmask} "
else
logger -t xcat -p local4.err "configeth: the ipaddress( $str_ip ) for $str_nic_name is invalid."
log_error "configeth on $NODE: the ipaddress( $str_ip ) for $str_nic_name is invalid."
error_code=1
fi
@ -817,7 +809,6 @@ if [ "$str_os_type" = "aix" ];then
hashset hash_new_config $str_old_ip "old"
else
chdev -l $str_nic_name -a netaddr='' -a netmask=''
logger -t xcat -p local4.err "configeth: delete undefined ip address $str_old_ip"
log_error "configeth on $NODE: delete undefined ip address $str_old_ip"
error_code=1
fi
@ -833,8 +824,7 @@ if [ "$str_os_type" = "aix" ];then
hashset hash_new_config $str_old_ip "old"
else
chdev -l $str_nic_name -a netaddr6='' -a prefixlen=''
logger -t xcat -p local4.err "configeth: delete undefined ipv6 address $str_old_ip"
echo "configeth on $NODE: delete undefined ipv6 address $str_old_ip"
log_error "configeth on $NODE: delete undefined ipv6 address $str_old_ip"
fi
fi
@ -886,7 +876,6 @@ if [ "$str_os_type" = "aix" ];then
do
str_ip_status=$(hashget hash_new_config $str_new_ip)
if [ "$str_ip_status" = "new" ];then
logger -t xcat -p local4.err "configeth: add $str_new_ip for $str_nic_name temporary."
log_info "configeth on $NODE: add $str_new_ip for $str_nic_name temporary."
add_ip_temporary $str_new_ip $str_nic_name
fi
@ -925,7 +914,6 @@ else
hashset hash_new_config $str_old_ip "old"
else
bool_modify_flag=1
logger -t xcat -p local4.err "configeth: delete $str_old_ip for $str_nic_name temporary."
log_info "configeth on $NODE: delete $str_old_ip for $str_nic_name temporary."
str_old_ip=`echo $str_old_ip | tr '_' '/'`
ip addr del $str_old_ip dev $str_nic_name
@ -967,7 +955,6 @@ else
if [ "$str_ip_status" = "new" ];then
bool_modify_flag=1
if [ $bool_restart_flag -eq 0 ];then
logger -t xcat -p local4.err "configeth: add $str_new_ip for $str_nic_name temporary."
log_info "configeth on $NODE: add $str_new_ip for $str_nic_name temporary."
add_ip_temporary $str_new_ip $str_nic_name
fi
@ -978,7 +965,6 @@ else
if [ $bool_restart_flag -eq 0 -a -n "$str_ipv6_gateway" ];then
ip -6 route | grep default | grep $str_ipv6_gateway
if [ $? -ne 0 ];then
logger -t xcat -p local4.err "configeth: the default ipv6 route changes to $str_ipv6_gateway."
log_info "configeth on $NODE: the default ipv6 route changes to $str_ipv6_gateway."
ip -6 route del default
ip -6 route add default $str_ipv6_gateway dev $str_dev_name
@ -1003,7 +989,6 @@ else
ip addr del $str_old_ip dev $str_nic_name
done
fi
logger -t xcat -p local4.err "configeth: $str_nic_name changed, modify the configuration files"
log_info "configeth on $NODE: $str_nic_name changed, modify the configuration files"
num_ipv4_index=0
num_ipv6_index=0
@ -1060,7 +1045,6 @@ else
num_index=$((num_index+1))
done
else
logger -t xcat -p local4.err "configeth: $str_nic_name no changed, return directly."
log_warn "configeth on $NODE: $str_nic_name no changed, return directly."
fi

View File

@ -27,7 +27,11 @@ brctl="brctl"
uniq="uniq"
xargs="xargs"
modprobe="modprobe"
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
#########################################################################
# ifdown/ifup will not be executed in diskful provision postscripts stage
#########################################################################
@ -87,6 +91,7 @@ function log_lines {
function log_error {
local __msg="$*"
$log_print_cmd $log_print_arg "[E]:Error: $__msg"
logger -t $log_label -p local4.err "$__msg"
return 1
}
@ -103,6 +108,7 @@ function log_error {
function log_warn {
local __msg="$*"
$log_print_cmd $log_print_arg "[W]: $__msg"
logger -t $log_label -p local4.info "$__msg"
return 0
}
@ -119,6 +125,7 @@ function log_warn {
function log_info {
local __msg="$*"
$log_print_cmd $log_print_arg "[I]: $__msg"
logger -t $log_label -p local4.info "$__msg"
return 0
}

View File

@ -23,6 +23,12 @@
#=cut
#-------------------------------------------------------------------------------
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
# pmatch determines if 1st argument string is matched by 2nd argument pattern
pmatch ()
{
@ -350,9 +356,9 @@ IFS=$OIFS
# fi
#fi
logger -t xcat -p local4.info "NFSSERVER=$NFSSERVER"
logger -t xcat -p local4.info "OSPKGDIR=$OSPKGDIR"
logger -t xcat -p local4.info "OSPKGS=$OSPKGS"
logger -t $log_label -p local4.info "NFSSERVER=$NFSSERVER"
logger -t $log_label -p local4.info "OSPKGDIR=$OSPKGDIR"
logger -t $log_label -p local4.info "OSPKGS=$OSPKGS"
if [ $debug -ne 0 ]; then
echo NFSSERVER=$NFSSERVER
@ -472,13 +478,13 @@ if ( pmatch "$OSVER" "sles10*" ); then
fi
result=`rug sa $path $OSVER`
if [ $? -ne 0 ]; then
logger -t xcat -p local4.info "ospkgs: rug sa $path $OSVER\n $result"
logger -t $log_label -p local4.info "ospkgs: rug sa $path $OSVER\n $result"
echo "ospkgs: rug sa $path $OSVER"
echo " $result"
fi
result=`rug sub $OSVER`
if [ $? -ne 0 ]; then
logger -t xcat -p local4.info "ospkgs: rug sub $OSVER\n $result"
logger -t $log_label -p local4.info "ospkgs: rug sub $OSVER\n $result"
echo "ospkgs: rug sub $OSVER"
echo " $result"
fi
@ -492,7 +498,7 @@ if ( pmatch "$OSVER" "sles10*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "rug update -y --agree-to-third-party-licences\n $result"
logger -t $log_label -p local4.info "rug update -y --agree-to-third-party-licences\n $result"
echo "ospkgs: rug update -y --agree-to-third-party-licences"
echo " $result"
else
@ -510,7 +516,7 @@ if ( pmatch "$OSVER" "sles10*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -528,7 +534,7 @@ if ( pmatch "$OSVER" "sles10*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -546,7 +552,7 @@ if ( pmatch "$OSVER" "sles10*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -591,7 +597,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
result=`zypper ar $path xCAT-$OSVER 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER\n $result"
logger -t $log_label -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER\n $result"
echo "ospkgs: zypper ar $path xCAT-OSVER"
echo " $result"
fi
@ -607,7 +613,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
result=`zypper ar $path xCAT-$OSVER-"path$i" 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER-path$i\n $result"
logger -t $log_label -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER-path$i\n $result"
echo "ospkgs: zypper ar $path xCAT-$OSVER-path$i"
echo " $result"
fi
@ -633,7 +639,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
result=`zypper ar $sdk_src xCAT-$OSVER-$bname 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $sdk_src xCAT-$OSVER-bname\n $result"
logger -t $log_label -p local4.info "ospkgs: zypper ar $sdk_src xCAT-$OSVER-bname\n $result"
echo "ospkgs: zypper ar $sdk_src xCAT-$OSVER-bname"
echo " $result"
fi
@ -653,7 +659,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: zypper --non-interactive update --auto-agree-with-licenses\n $result"
logger -t $log_label -p local4.info "ospkgs: zypper --non-interactive update --auto-agree-with-licenses\n $result"
echo "ospkgs: zypper --non-interactive update --auto-agree-with-licenses"
echo " $result"
else
@ -670,7 +676,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -688,7 +694,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd $result"
logger -t $log_label -p local4.info "ospkgs: $cmd $result"
echo "ospkgs: $cmd"
echo $result
else
@ -708,7 +714,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -726,7 +732,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd $result"
logger -t $log_label -p local4.info "ospkgs: $cmd $result"
echo "ospkgs: $cmd"
echo $result
else
@ -900,7 +906,7 @@ else
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: yum -y upgrade\n $result"
logger -t $log_label -p local4.info "ospkgs: yum -y upgrade\n $result"
echo "ospkgs: yum -y upgrade"
echo " $result"
else
@ -918,7 +924,7 @@ else
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -936,7 +942,7 @@ else
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -959,7 +965,7 @@ else
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -977,7 +983,7 @@ else
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else
@ -995,7 +1001,7 @@ else
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -t xcat -p local4.info "ospkgs: $cmd\n $result"
logger -t $log_label -p local4.info "ospkgs: $cmd\n $result"
echo "ospkgs: $cmd"
echo $result
else

View File

@ -24,11 +24,16 @@
#enable debug
#set -x
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
if [ -f /etc/os-release ] && cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then
#TODO
echo "Cumulus OS is not supported yet, nothing to do..."
logger -t xcat -p local4.info "Cumulus OS is not supported yet, nothing to do..."
logger -t $log_label -p local4.info "Cumulus OS is not supported yet, nothing to do..."
exit 0
fi
@ -210,10 +215,10 @@ apt_get_update_if_repos_changed()
RETURNVAL=0
if [ "$(uname -s)" = "AIX" ]; then
logger -p local4.info -t xcat "otherpkgs not support on AIX, exiting "
logger -p local4.info -t $log_label "otherpkgs not support on AIX, exiting "
exit 0
else
logger -p local4.info -t xcat "Running otherpkgs "
logger -p local4.info -t $log_label "Running otherpkgs "
fi
if [ -z "$UPDATENODE" ] || [ $UPDATENODE -ne 1 ]; then
if [ "$NODESETSTATE" = "netboot" -o \
@ -385,11 +390,11 @@ fi
if [ $VERBOSE ]; then
echo NFSSERVER=$NFSSERVER
fi
logger -p local4.info -t xcat "NFSSERVER=$NFSSERVER"
logger -p local4.info -t $log_label "NFSSERVER=$NFSSERVER"
if [ $VERBOSE ]; then
echo OTHERPKGDIR=$OTHERPKGDIR
fi
logger -p local4.info -t xcat "OTHERPKGDIR=$OTHERPKGDIR"
logger -p local4.info -t $log_label "OTHERPKGDIR=$OTHERPKGDIR"
#if [ -x "/sbin/dhcpcd" ]; then
# dhcpcd -n $PRIMARYNIC
@ -461,7 +466,7 @@ if ( ! ( pmatch "$OSVER" "sles10*" ) && [ $haszypper -eq 1 ] ); then
result=`zypper ar $path xCAT-$OSVER 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER\n $result"
logger -t $log_label -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER\n $result"
if [ $VERBOSE ]; then
echo "ospkgs: zypper ar $path xCAT-$OSVER"
echo " $result"
@ -479,7 +484,7 @@ if ( ! ( pmatch "$OSVER" "sles10*" ) && [ $haszypper -eq 1 ] ); then
result=`zypper ar $path xCAT-$OSVER-"path$i" 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER-path$i\n $result"
logger -t $log_label -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER-path$i\n $result"
if [ $VERBOSE ]; then
echo "ospkgs: zypper ar $path xCAT-$OSVER-path$i"
echo " $result"
@ -507,7 +512,7 @@ if ( ! ( pmatch "$OSVER" "sles10*" ) && [ $haszypper -eq 1 ] ); then
result=`zypper ar $sdk_src xCAT-$OSVER-$bname 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "otherpkgs: zypper ar $sdk_src xCAT-$OSVER-bname\n $result"
logger -t $log_label -p local4.info "otherpkgs: zypper ar $sdk_src xCAT-$OSVER-bname\n $result"
if [ $VERBOSE ]; then
echo "otherpkgs: zypper ar $sdk_src xCAT-$OSVER-bname"
echo " $result"
@ -818,7 +823,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$result"
if [ $VERBOSE ]; then
echo "$result"
fi
@ -832,7 +837,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$result"
if [ $VERBOSE ]; then
echo "$result"
fi
@ -846,7 +851,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$result"
if [ $VERBOSE ]; then
echo "$result"
fi
@ -867,7 +872,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$result"
if [ $VERBOSE ]; then
echo "$result"
fi
@ -880,7 +885,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$result"
if [ $VERBOSE ]; then
echo "$result"
fi
@ -894,7 +899,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$result"
if [ $VERBOSE ]; then
echo "$result"
fi
@ -910,7 +915,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$result"
if [ $VERBOSE ]; then
echo "$result"
fi
@ -927,8 +932,9 @@ EOF`
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -p local4.err -t $log_label "$envlist yum -y install $repo_pkgs failed."
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$repo_pkgs installed."
if [ $VERBOSE ]; then
echo "$result"
fi
@ -940,8 +946,9 @@ EOF`
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -p local4.err -t $log_label "$envlist zypper install -y $repo_pkgs 2>&1 failed."
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$repo_pkgs installed."
if [ $VERBOSE ]; then
echo "$result"
fi
@ -960,8 +967,9 @@ EOF`
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
logger -p local4.err -t $log_label "install $repo_pkgs failed."
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$repo_pkgs installed."
if [ $VERBOSE ]; then
echo "$result"
fi
@ -971,7 +979,7 @@ EOF`
#Handle the rest with rpm
if [ "$plain_pkgs" != "" -a -n "$OTHERPKGDIR" ]; then
echo "Warning: the packages $plain_pkgs could not be found in the yum/apt repository, falling back to rpm/dpkg command. If you want your packages to be installed with yum/apt, verify yum/apt is installed and createrepo/dpkg-scanpackages has been run."
logger -p local4.info -t xcat "Warning: the packages $plain_pkgs could not be found in the yum/apt repository, falling back to rpm/dpkg command. If you want your packages to be installed with yum/apt, verify yum/apt is installed and createrepo/dpkg-scanpackages has been run."
logger -p local4.info -t $log_label "Warning: the packages $plain_pkgs could not be found in the yum/apt repository, falling back to rpm/dpkg command. If you want your packages to be installed with yum/apt, verify yum/apt is installed and createrepo/dpkg-scanpackages has been run."
if [ $mounted -eq 0 ]; then
dir_no_ftproot=${OTHERPKGDIR#*$INSTALLDIR/}
mkdir -p /xcatpost/$dir_no_ftproot
@ -998,7 +1006,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$plain_pkgs installed."
if [ $VERBOSE ]; then
echo "$result"
fi
@ -1022,7 +1030,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$repo_pkgs_postremove removed."
if [ $VERBOSE ]; then
echo "$result"
fi
@ -1035,7 +1043,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$repo_pkgs_postremove removed."
if [ $VERBOSE ]; then
echo "$result"
fi
@ -1049,7 +1057,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$repo_pkgs_postremove removed."
if [ $VERBOSE ]; then
echo "$result"
fi
@ -1065,7 +1073,7 @@ EOF`
if [ $R -ne 0 ]; then
RETURNVAL=$R
fi
logger -p local4.info -t xcat "$result"
logger -p local4.info -t $log_label "$plain_pkgs_postremove removed."
if [ $VERBOSE ]; then
echo "$result"
fi

View File

@ -11,11 +11,16 @@
# id.rsa
#
# if on the Management Node, exit
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
umask 0077
if [ -f /etc/os-release ] && cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then
#TODO
echo "Cumulus OS is not supported yet, nothing to do..."
logger -t xcat -p local4.info "Cumulus OS is not supported yet, nothing to do..."
logger -t $log_label -p local4.info "Cumulus OS is not supported yet, nothing to do..."
exit 0
fi
@ -25,7 +30,7 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then
fi
if [ -e /etc/xCATMN ]; then
logger -t xcat -p local4.info "remoteshell:Running on the Management Node , exiting "
logger -t $log_label -p local4.info "remoteshell:Running on the Management Node , exiting "
exit 0
fi
# if -p input, do special PCM setup
@ -39,7 +44,7 @@ fi
# Linux or if AIX call aixremoteshell -d
if [ "$(uname -s)" = "AIX" ]; then
./aixremoteshell -d 2>&1
logger -t xcat -p local4.info "Install: On AIX , remoteshell calling aixremoteshell -d "
logger -t $log_label -p local4.info "Install: On AIX , remoteshell calling aixremoteshell -d "
exit 0
fi
master=$MASTER
@ -51,7 +56,7 @@ fi
if [ -r /etc/ssh/sshd_config ]
then
logger -t xcat -p local4.info "remoteshell: setup /etc/ssh/sshd_config and ssh_config"
logger -t $log_label -p local4.info "remoteshell: setup /etc/ssh/sshd_config and ssh_config"
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG
#delete all occurance of the attribute and then add xCAT settings
sed -i '/X11Forwarding /'d /etc/ssh/sshd_config
@ -78,7 +83,7 @@ fi
xcatpost="xcatpost"
if [ -d /xcatpost/_ssh ]
then
logger -p local4.info -t xcat "Install: setup root .ssh"
logger -p local4.info -t $log_label "Install: setup root .ssh"
cd /xcatpost/_ssh
mkdir -p /root/.ssh
cp -f * /root/.ssh
@ -88,7 +93,7 @@ then
fi
if [ ! -x /usr/bin/openssl ]; then
logger -t xcat -p local4.err "Install: /usr/bin/openssl is not executable."
logger -t $log_label -p local4.err "Install: /usr/bin/openssl is not executable."
exit 0
fi
allowcred.awk &
@ -98,12 +103,12 @@ sleep 1
#download the ssh host dsa private keys
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest received response return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest received response return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
@ -116,7 +121,7 @@ grep -E '<error>' /tmp/ssh_dsa_hostkey > /dev/null 2>&1
if [ $? -ne 0 ]; then
#the message received is the data
cat /tmp/ssh_dsa_hostkey | grep -E -v '</{0,1}errorcode>|/{0,1}data>|</{0,1}content>|</{0,1}desc>' >/etc/ssh/ssh_host_dsa_key
logger -t xcat -p local4.info "remoteshell: getting ssh_host_dsa_key"
logger -t $log_label -p local4.info "remoteshell: getting ssh_host_dsa_key"
MAX_RETRIES=10
RETRY=0
MYCONT=`cat /etc/ssh/ssh_host_dsa_key`
@ -135,12 +140,12 @@ if [ $? -ne 0 ]; then
fi
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
@ -158,19 +163,19 @@ if [ $? -ne 0 ]; then
else
#the message received is an error, so parse it
ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/ssh_dsa_hostkey`
logger -s -t xcat -p local4.err Error: $ERR_MSG
logger -s -t $log_label -p local4.err Error: $ERR_MSG
fi
rm /tmp/ssh_dsa_hostkey
# download the host rsa key
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
@ -182,7 +187,7 @@ grep -E '<error>' /tmp/ssh_rsa_hostkey > /dev/null 2>&1
if [ $? -ne 0 ]; then
#the message received is the data we request
cat /tmp/ssh_rsa_hostkey | grep -E -v '</{0,1}errorcode>|/{0,1}data>|</{0,1}content>|</{0,1}desc>' >/etc/ssh/ssh_host_rsa_key
logger -t xcat -p local4.info ssh_rsa_hostkey
logger -t $log_label -p local4.info ssh_rsa_hostkey
MYCONT=`cat /etc/ssh/ssh_host_rsa_key`
MAX_RETRIES=10
RETRY=0
@ -200,12 +205,12 @@ if [ $? -ne 0 ]; then
fi
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
@ -224,7 +229,7 @@ if [ $? -ne 0 ]; then
else
#This is an error message
ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/ssh_rsa_hostkey`
logger -s -t xcat -p local4.err Error: $ERR_MSG
logger -s -t $log_label -p local4.err Error: $ERR_MSG
fi
rm /tmp/ssh_rsa_hostkey
@ -236,12 +241,12 @@ if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then
# download the host ecdsa key
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
@ -253,7 +258,7 @@ if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then
if [ $? -ne 0 ]; then
#the message received is the data we request
cat /tmp/ssh_ecdsa_hostkey | grep -E -v '</{0,1}errorcode>|/{0,1}data>|</{0,1}content>|</{0,1}desc>' >/etc/ssh/ssh_host_ecdsa_key
logger -t xcat -p local4.info ssh_ecdsa_hostkey
logger -t $log_label -p local4.info ssh_ecdsa_hostkey
MYCONT=`cat /etc/ssh/ssh_host_ecdsa_key`
MAX_RETRIES=10
RETRY=0
@ -271,12 +276,12 @@ if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then
fi
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
@ -303,7 +308,7 @@ if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then
else
#This is an error message
ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/ssh_ecdsa_hostkey`
logger -s -t xcat -p local4.err Error: $ERR_MSG
logger -s -t $log_label -p local4.err Error: $ERR_MSG
fi
rm /tmp/ssh_ecdsa_hostkey
fi
@ -327,26 +332,26 @@ then
zonename=$ZONENAME
rootsshpvtkey=ssh_root_key:$zonename
rootsshpubkey=ssh_root_pub_key:$zonename
logger -t xcat -p local4.info "remoteshell: gathering root ssh keys for $zonename"
logger -t $log_label -p local4.info "remoteshell: gathering root ssh keys for $zonename"
fi
# always get the id_rsa.pub key for the node and put in authorized_keys
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
getcredentials.awk $rootsshpubkey | grep -E -v '</{0,1}xcatresponse>|</{0,1}serverdone>'|sed -e 's/&lt;/</' -e 's/&gt;/>/' -e 's/&amp;/&/' -e 's/&quot/"/' -e "s/&apos;/'/" > /tmp/ssh_root_pub_key
logger -t xcat -p local4.info "remoteshell: gathering $rootsshpubkey "
logger -t $log_label -p local4.info "remoteshell: gathering $rootsshpubkey "
#check whether the message is an error or not
grep -E '<error>' /tmp/ssh_root_pub_key
if [ $? -ne 0 ]; then
@ -354,7 +359,7 @@ if [ $? -ne 0 ]; then
cat /tmp/ssh_root_pub_key | grep -E -v '</{0,1}errorcode>|</{0,1}data>|</{0,1}content>|</{0,1}desc>' > /root/.ssh/id_rsa.pub
# no add to authorized_keys, so the node can ssh to itself
cat /tmp/ssh_root_pub_key | grep -E -v '</{0,1}errorcode>|</{0,1}data>|</{0,1}content>|</{0,1}desc>' >> /root/.ssh/authorized_keys
logger -t xcat -p local4.info ssh_root_pub_key
logger -t $log_label -p local4.info ssh_root_pub_key
MYCONT=`cat /root/.ssh/id_rsa.pub`
MAX_RETRIES=10
RETRY=0
@ -371,12 +376,12 @@ if [ $? -ne 0 ]; then
fi
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
@ -387,34 +392,34 @@ if [ $? -ne 0 ]; then
else
#This is an error message
ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/ssh_root_pub_key`
logger -t xcat -p local4.err $rootsshpubkey Error: $ERR_MSG
logger -t $log_label -p local4.err $rootsshpubkey Error: $ERR_MSG
fi
rm /tmp/ssh_root_pub_key
# if sshbetweennodes is enabled then we get id_rsa ( private key)
if [ $ENABLESSHBETWEENNODES = "YES" ]; # want nodes to be able to ssh to each other without password
then
logger -t xcat -p local4.info "remoteshell:sshbetweennodes is yes"
logger -t $log_label -p local4.info "remoteshell:sshbetweennodes is yes"
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
getcredentials.awk $rootsshpvtkey | grep -E -v '</{0,1}xcatresponse>|</{0,1}serverdone>'|sed -e 's/&lt;/</' -e 's/&gt;/>/' -e 's/&amp;/&/' -e 's/&quot/"/' -e "s/&apos;/'/" > /tmp/ssh_root_key
logger -t xcat -p local4.info "remoteshell: gathering $rootsshpvtkey "
logger -t $log_label -p local4.info "remoteshell: gathering $rootsshpvtkey "
#check whether the message is an error or not
grep -E '<error>' /tmp/ssh_root_key
if [ $? -ne 0 ]; then
#The message contains the data we request
cat /tmp/ssh_root_key | grep -E -v '</{0,1}errorcode>|/{0,1}data>|</{0,1}content>|</{0,1}desc>' > /root/.ssh/id_rsa
logger -t xcat -p local4.info ssh_root_key
logger -t $log_label -p local4.info ssh_root_key
MYCONT=`cat /root/.ssh/id_rsa`
MAX_RETRIES=10
RETRY=0
@ -431,12 +436,12 @@ then
fi
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
logger -t xcat -p local4.info "remoteshell:xcatflowrequest return=$rc"
logger -t $log_label -p local4.info "remoteshell:xcatflowrequest return=$rc"
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest, will not use flow control"
useflowcontrol=0
fi
fi
@ -446,7 +451,7 @@ then
else
#This is an error message
ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/ssh_root_key`
logger -t xcat -p local4.err $rootsshpvtkey Error: $ERR_MSG
logger -t $log_label -p local4.err $rootsshpvtkey Error: $ERR_MSG
fi
rm /tmp/ssh_root_key
@ -457,26 +462,26 @@ then
if [ ! -f /root/.ssh/id_rsa.pub ]; then
if [ -r /root/.ssh/id_rsa ]; then
ssh-keygen -y -f /root/.ssh/id_rsa > /root/.ssh/id_rsa.pub
logger -t xcat -p local4.err remoteshell:transfer of the id_rsa.pub key failed. Had to generate a public key.
logger -t $log_label -p local4.err remoteshell:transfer of the id_rsa.pub key failed. Had to generate a public key.
fi
fi
fi
# if secureroot is enabled then we get root password hash, not for updatenode
if [ "x$SECUREROOT" = "x1" ] && [ "x$UPDATENODE" != "x1" ]; then
logger -t xcat -p local4.info "remoteshell: secure root is enabled"
logger -t $log_label -p local4.info "remoteshell: secure root is enabled"
if [ $useflowcontrol = "1" ]; then
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest (rc=$rc), will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest (rc=$rc), will not use flow control"
useflowcontrol=0
fi
fi
getcredentials.awk xcat_secure_pw:root | grep -E -v '</{0,1}xcatresponse>|</{0,1}serverdone>'|sed -e 's/&lt;/</' -e 's/&gt;/>/' -e 's/&amp;/&/' -e 's/&quot/"/' -e "s/&apos;/'/" > /tmp/secure_root_hash
logger -t xcat -p local4.info "remoteshell: gathering password hash for root"
logger -t $log_label -p local4.info "remoteshell: gathering password hash for root"
#check whether the message is an error or not
grep -E '<error>' /tmp/secure_root_hash > /dev/null
if [ $? -ne 0 ]; then
@ -498,11 +503,11 @@ if [ "x$SECUREROOT" = "x1" ] && [ "x$UPDATENODE" != "x1" ]; then
fi
if [ $useflowcontrol = "1" ]; then
#first contact daemon xcatflowrequest <server> 3001
logger -t xcat -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
logger -t $log_label -p local4.info "remoteshell: sending xcatflowrequest $master 3001"
/$xcatpost/xcatflowrequest $master 3001
rc=$?
if [ $rc -ne 0 ]; then
logger -t xcat -p local4.info "remoteshell: error from xcatflowrequest (rc=$rc), will not use flow control"
logger -t $log_label -p local4.info "remoteshell: error from xcatflowrequest (rc=$rc), will not use flow control"
useflowcontrol=0
fi
fi
@ -525,12 +530,12 @@ if [ "x$SECUREROOT" = "x1" ] && [ "x$UPDATENODE" != "x1" ]; then
fi
rm /tmp/secure_root_hash
if [ "x" != "x$ERR_MSG" ]; then
logger -t xcat -p local4.err "Failed to acquire secure root password: $ERR_MSG"
logger -t $log_label -p local4.err "Failed to acquire secure root password: $ERR_MSG"
fi
fi
# start up the sshd for syncfiles postscript to do the sync work
logger -t xcat -p local4.info "start up sshd"
logger -t $log_label -p local4.info "start up sshd"
if [[ $OSVER == ubuntu* || $OSVER == debian* ]]
then
if [ ! -d /var/run/sshd ];then

View File

@ -7,17 +7,23 @@
#
#####################################################
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
bname=$(basename $0)
#statelite does not support syncfiles
if [ -d /.statelite ]; then
echo "Statelite does not support syncfiles, nothing to do..."
logger -t xcat -p local4.info "Statelite does not support syncfiles, nothing to do..."
logger -t $log_label -p local4.info "Statelite does not support syncfiles, nothing to do..."
exit 0
fi
# do nothing when UPDATENODE=1 because it is done from the top down
if [ -n "$UPDATENODE" ] && [ $UPDATENODE -eq 1 ]; then
#echo " Did not sync any files. Use updatenode -F to sync the files."
logger -t xcat -p local4.err "$0: Did not sync any files. Use updatenode -F to sync the files."
logger -t $log_label -p local4.warning "$bname: Did not sync any files. Use updatenode -F to sync the files."
exit 0
fi
@ -25,7 +31,7 @@ fi
#do nothing id there is no sync file template for the node
if [ -n "$NOSYNCFILES" ] && [ $NOSYNCFILES -eq 1 ]; then
echo " Did not sync any files."
logger -t xcat -p local4.err "$0: there is no sync file template for the node"
logger -t $log_label -p local4.info "$bname: there is no sync file template for the node"
exit 0
fi
@ -34,13 +40,13 @@ if [ ! -e "/usr/bin/rsync" ]; then
[ -e "/usr/bin/scp" ] && RCP="/usr/bin/scp"
fi
logger -t xcat -p local4.info "Performing syncfiles postscript"
logger -t $log_label -p local4.info "Performing syncfiles postscript"
osname=`uname`
# run the xdcp on the MN/SN
xcatpostdir="/xcatpost"
logger -t xcat -p local4.info "$0: the OS name = $osname"
logger -t $log_label -p local4.info "$bname: the OS name = $osname"
quit="no"
count=5
returncode=0
@ -70,9 +76,9 @@ done
if [ $returncode -eq 0 ]
then
logger -t xcat -p local4.info "$0: Perform Syncing File action successfully"
logger -t $log_label -p local4.info "$bname: Perform Syncing File action successfully"
else
logger -t xcat -p local4.err "$0: Perform Syncing File action encountered error"
logger -t $log_label -p local4.err "$bname: Perform Syncing File action encountered error"
fi
[ $returncode -eq 0 ]

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#-------------------------------------------------------------------------------
@ -13,6 +13,12 @@
# OSVER: possible values are sles10, fedora8, redhat5, aix etc.
#=cut
#-------------------------------------------------------------------------------
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
if [ "$SYSLOG" = "ignore" ]; then
echo "The value of syslog is '$SYSLOG'."
exit 0
@ -303,7 +309,7 @@ if [ -e "/sbin/rsyslogd" -o -e "/usr/sbin/rsyslogd" ]; then
if ( pmatch $SYSLOGPROD "*rsyslogd*" ) && ( pmatch $SYSLOGVER "8*" ); then
config_rsyslog_V8
#keep a record
logger -t xcat -p local4.info "Install: rsyslog version 8 setup"
logger -t $log_label -p local4.info "Install: rsyslog version 8 setup"
exit 0
fi
fi
@ -527,5 +533,5 @@ else
fi
#keep a record
logger -t xcat -p local4.info "Install: syslog setup"
logger -t $log_label -p local4.info "Install: syslog setup"
exit 0

View File

@ -893,6 +893,7 @@ run_ps () {
else
log_label=\"xcat.updatenode.\"\$scriptype
fi
export LOGLABEL=\$log_label
if [ -f \$1 ]; then
echo \"\$scriptype start..: \$1\"
msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype start..: \$1\"" \"\$logfile\" \"\$log_label\"
@ -993,7 +994,6 @@ fi
#tell user it is done when this is called by updatenode command
if [ "$MODE" = "1" ] || [ "$MODE" = "2" ] || [ "$MODE" = "5" ]; then
echolog "info" "returned from postscript"
echolog "info" "=============updatenode ending===================="
fi

View File

@ -19,9 +19,15 @@ if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
XCATSERVER=$(grep --only-matching "\<XCAT=[^ ]*\>" /proc/cmdline |cut -d= -f2 |cut -d: -f1 2>/dev/null)
logger -t xcat -p local4.info "$0: action is $1"
logger -t $log_label -p local4.info "$0: action is $1"
case $1 in
restart)
$0 stop
@ -29,11 +35,11 @@ restart)
;;
status)
echo -n "xcatpostinit runs only at boot, runs additional post scripts"
logger -t xcat -p local4.info "xcatpostinit runs only at boot, runs additional post scripts"
logger -t $log_label -p local4.info "xcatpostinit runs only at boot, runs additional post scripts"
;;
stop)
echo -n "nothing to stop "
logger -t xcat -p local4.info "nothing to stop"
logger -t $log_label -p local4.info "nothing to stop"
grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off"
;;
start)
@ -55,7 +61,7 @@ start)
# Test for script existance
if ! [ -x "$SCRIPT" ]; then
msg "can't locate executable $SCRIPT"
logger -t $log_label -p local4.info "Unable to locate script $SCRIPT."
grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus failed"
exit -1
fi
@ -63,10 +69,10 @@ start)
# Run $SCRIPT according to node type
grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus postbooting"
if [ $STATELITE -ne 0 ]; then
logger -t xcat -p local4.info "Call $SCRIPT for statelite mode"
logger -t $log_label -p local4.info "Call $SCRIPT for statelite mode"
"$SCRIPT" 4
else
logger -t xcat -p local4.info "Call $SCRIPT for stateless mode"
logger -t $log_label -p local4.info "Call $SCRIPT for stateless mode"
"$SCRIPT"
fi
;;

View File

@ -6,6 +6,7 @@ After=network.target rsyslog.service
Type=oneshot
ExecStart=/opt/xcat/xcatpostinit1 start
ExecStop=/opt/xcat/xcatpostinit1 stop
StandardOutput=null
RemainAfterExit=yes
[Install]