diff --git a/docs/source/guides/admin-guides/basic_concepts/global_cfg/index.rst b/docs/source/guides/admin-guides/basic_concepts/global_cfg/index.rst index 43a7206d1..37c209201 100644 --- a/docs/source/guides/admin-guides/basic_concepts/global_cfg/index.rst +++ b/docs/source/guides/admin-guides/basic_concepts/global_cfg/index.rst @@ -79,7 +79,13 @@ Install/Deployment Attributes (``yes/1`` or ``no/0``). Default is ``no``. If yes, it will instruct xCAT at ``nodeset`` and ``updatenode`` time to query the db once for all of the nodes passed into the cmd and create the mypostscript file for each node, and put them in a directory of tftpdir(such as: /tftpboot). If no, it will not generate the mypostscript file in the ``tftpdir``. * xcatdebugmode: - the value of xcat debug mode. Currently supported values: ``0: off(default); 1: on`` + the xCAT debug level. xCAT provides a batch of techniques to help user debug problems while using xCAT, especially on OS provision, such as collecting logs of the whole installation process and accessing the installing system via ssh, etc. These techniques will be enabled according to different xCAT debug levels specified by 'xcatdebugmode', currently supported values: :: + + '0': disable debug mode + '1': enable basic debug mode + '2': enalbe expert debug mode + + For the details on 'basic debug mode' and 'expert debug mode', please refer to xCAT documentation. Remoteshell Attributes diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index e9a20a4e6..962517f45 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -299,8 +299,17 @@ site Attributes: are all using a common shared filesystem. The default is 'no'. xcatconfdir: Where xCAT config data is (default /etc/xcat). - xcatdebugmode: the value of xcat debug mode. Currently supported values: - 0: off(default); 1: on + xcatdebugmode: the xCAT debug level. xCAT provides a batch of techniques + to help user debug problems while using xCAT, especially on OS provision, + such as collecting logs of the whole installation process and accessing + the installing system via ssh, etc. These techniques will be enabled + according to different xCAT debug levels specified by 'xcatdebugmode', + currently supported values: + '0': disable debug mode + '1': enable basic debug mode + '2': enalbe expert debug mode + For the details on 'basic debug mode' and 'expert debug mode', + please refer to xCAT documentation. -------------------- REMOTESHELL ATTRIBUTES diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index 6c0dd48cc..d4bcc879e 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -790,10 +790,10 @@ sub trace(){ if(($level eq "W")||($level eq "w")){$prefix="WARNING";} if(($level eq "I")||($level eq "i")){$prefix="INFO";} if(($level eq "D")||($level eq "d")){$prefix="DEBUG";} - + my @tmp = xCAT::TableUtils->get_site_attribute("xcatdebugmode"); my $xcatdebugmode=$tmp[0]; - + if (($level eq "E") ||($level eq "e") ||($level eq "I") @@ -810,7 +810,7 @@ sub trace(){ if (($level eq "D") ||($level eq "d")){ - if(($verbose == 1 )||($xcatdebugmode eq "1")){ + if(($verbose == 1 )||($xcatdebugmode eq "1")||($xcatdebugmode eq "2")){ my $msg = $prefix." ".$logcontent; eval { openlog("xcat", "nofatal,pid", "local4"); diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index ba079fc8f..35bcb91b7 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1123,8 +1123,17 @@ use xCAT::ExtTab; " 'all' means that the management as well as the service nodes\n" . " are all using a common shared filesystem. The default is 'no'.\n" . " xcatconfdir: Where xCAT config data is (default /etc/xcat).\n\n" . -" xcatdebugmode: the value of xcat debug mode. Currently supported values: \n" . -" 0: off(default); 1: on \n\n" . +" xcatdebugmode: the xCAT debug level. xCAT provides a batch of techniques\n". +" to help user debug problems while using xCAT, especially on OS provision,\n". +" such as collecting logs of the whole installation process and accessing\n". +" the installing system via ssh, etc. These techniques will be enabled\n". +" according to different xCAT debug levels specified by 'xcatdebugmode',\n". +" currently supported values:\n". +" '0': disable debug mode\n". +" '1': enable basic debug mode\n". +" '2': enalbe expert debug mode\n". +" For the details on 'basic debug mode' and 'expert debug mode',\n". +" please refer to xCAT documentation.\n\n". " --------------------\n" . "REMOTESHELL ATTRIBUTES\n" . " --------------------\n" . diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index c3d86d410..fbd2cf9ba 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -351,8 +351,12 @@ sub subvars { $inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg; $inc =~ s/#GETPRINICMAC:([^#]+)#/xCAT::Utils::parseMacTabEntry(tabdb("mac",$1,"mac"),$1)/eg; - if($::XCATSITEVALS{xcatdebugmode} eq "1"){ - $inc =~ s/#UNCOMMENONXCATDEBUGMODE#/ /g; + if(($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")){ + $inc =~ s/#UNCOMMENTOENABLEDEBUGPORT#/ /g; + } + + if($::XCATSITEVALS{xcatdebugmode} eq "2"){ + $inc =~ s/#UNCOMMENTOENABLESSH#/ /g; } my $nrtab = xCAT::Table->new("noderes"); @@ -1604,6 +1608,13 @@ sub tabdb } return ""; #return "#TABLEBAD:$table:field $field not found#"; + } else { + # check for site.xcatdebugmode + if (($table =~ /site/) and ($key =~ /xcatdebugmode/)) { + if ((($ent->{$field}) ne "0") and (($ent->{$field}) ne "1") and (($ent->{$field}) ne "2")) { + $tmplerr="Unable to recognise filed <$field> from table <$table>, with key <$key>. Please enter '0' '1' or '2'" + } + } } return $ent->{$field}; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 46aab4a99..fa5c05c15 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1528,15 +1528,17 @@ sub mkinstall } } - if($::XCATSITEVALS{xcatdebugmode} eq "1"){ + if(($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")){ unless($instserver eq '!myipfn!'){ my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($instserver); $instserver=$ip; } if (xCAT::Utils->version_cmp($kversion,"7.0") >= 0){ - #enable ssh access during installation - $kcmdline .= " inst.sshd"; + if($::XCATSITEVALS{xcatdebugmode} eq "2"){ + #enable ssh access during installation + $kcmdline .= " inst.sshd"; + } #set minimum level of messages to be logged on the console #to be "debug" @@ -1545,7 +1547,9 @@ sub mkinstall #all the logs during installation will be forwarded to xcatmster $kcmdline .=" inst.syslog=$instserver"; }else{ - $kcmdline .= " sshd=1"; + if($::XCATSITEVALS{xcatdebugmode} eq "2"){ + $kcmdline .= " sshd=1"; + } $kcmdline .=" syslog=$instserver"; } diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index d7e9bd77c..7b72c6793 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -181,7 +181,7 @@ sub setstate { } - if($::XCATSITEVALS{xcatdebugmode} eq "1"){ + if(($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")){ print $pcfg "set debug=all\n"; } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index dee5434d0..66bfe6527 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1247,15 +1247,17 @@ sub mkinstall } - if($::XCATSITEVALS{xcatdebugmode} eq "1"){ + if(($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")){ unless($netserver eq '!myipfn!'){ my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($netserver); $netserver=$ip; } - #enable ssh access during installation,the password is set to "cluster" - $kcmdline .=" UseSSH=1 SSHPassword=cluster"; + if($::XCATSITEVALS{xcatdebugmode} eq "2"){ + #enable ssh access during installation,the password is set to "cluster" + $kcmdline .=" UseSSH=1 SSHPassword=cluster"; + } $kcmdline .=" Loghost=$netserver"; } diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.common b/xCAT-server/share/xcat/install/scripts/post.rh.common index deaccae05..e3f570030 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.common +++ b/xCAT-server/share/xcat/install/scripts/post.rh.common @@ -49,7 +49,7 @@ fi export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}') -if [ "$XCATDEBUGMODE" > "0" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "PRINIC=$PRINIC, IP=$IP,HOSTNAME=$HOSTNAME" "/var/log/xcat/xcat.log" fi diff --git a/xCAT-server/share/xcat/install/scripts/post.rhels7 b/xCAT-server/share/xcat/install/scripts/post.rhels7 index 6d7d018a4..b34d7d012 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhels7 +++ b/xCAT-server/share/xcat/install/scripts/post.rhels7 @@ -10,7 +10,7 @@ for i in $(find /etc/sysconfig/network-scripts/ifcfg-*|egrep -v ifcfg-lo ) do nicname=$(echo $i|awk -F 'ifcfg-' '{print $2}') if ethtool $nicname|grep -E -i "Link detected.*yes" >/dev/null 2>&1 - if [ "$XCATDEBUGMODE" > "0" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "info" "set NIC $nicname to be activated on system boot" "/var/log/xcat/xcat.log" fi then sed -i 's/ONBOOT=no/ONBOOT=yes/' $i diff --git a/xCAT-server/share/xcat/install/scripts/post.sles.common b/xCAT-server/share/xcat/install/scripts/post.sles.common index be6ad228c..2e0a48dc1 100755 --- a/xCAT-server/share/xcat/install/scripts/post.sles.common +++ b/xCAT-server/share/xcat/install/scripts/post.sles.common @@ -61,7 +61,7 @@ echo "Slept $jsi seconds before hostname made sense." HOSTNAME=$(hostname -s) echo $HOSTNAME -if [ "$XCATDEBUGMODE" != "0" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "PRINIC=$PRINIC,HOSTNAME=$HOSTNAME" "/var/log/xcat/xcat.log" fi /sbin/portmap diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu.common b/xCAT-server/share/xcat/install/scripts/post.ubuntu.common index 0b12ad126..7d1fa02a7 100755 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu.common +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu.common @@ -30,13 +30,13 @@ then IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}') fi -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "PRINIC=$PRINIC,IP=$IP" "/var/log/xcat/xcat.log" fi -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "generating /etc/resolv.conf" "/var/log/xcat/xcat.log" fi @@ -45,5 +45,3 @@ for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ') do echo "nameserver $i" done >>/etc/resolv.conf -#change the soft link /bin/sh to /bin/bash -ln -sf /bin/bash /bin/sh diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 644db48c6..108ee28e9 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -11,7 +11,7 @@ export XCATDEBUGMODE="#TABLEBLANKOKAY:site:key=xcatdebugmode:value#" #INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/scriptlib# -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then set -x fi @@ -30,7 +30,7 @@ fi cd /tmp RAND=$(perl -e 'print int(rand(50)). "\n"') -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "sleep $RAND" "/var/log/xcat/xcat.log" fi sleep $RAND @@ -49,13 +49,13 @@ if [ ! -f /opt/xcat/xcatinfo ]; then fi echo "XCATSERVER=$MASTER_IP" > /opt/xcat/xcatinfo echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "/opt/xcat/xcatinfo generated" "/var/log/xcat/xcat.log" fi # download the postscripts -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "trying to download postscripts from http://$MASTER_IP$INSTALLDIR/postscripts/" "/var/log/xcat/xcat.log" fi @@ -73,7 +73,7 @@ if [ "$?" != "0" ]; then sleep 36500d fi chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'` -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "postscripts downloaded successfully" "/var/log/xcat/xcat.log" fi @@ -84,13 +84,13 @@ if [ -x /xcatpost/mypostscript ]; then fi export NODE=#TABLE:nodelist:THISNODE:node# -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "trying to download precreated mypostscript file http://$MASTER_IP$TFTPDIR/mypostscripts/mypostscript.$NODE" "/var/log/xcat/xcat.log" fi wget -N --waitretry=10 --random-wait --retry-connrefused -t 20 -T 60 http://$MASTER_IP$TFTPDIR/mypostscripts/mypostscript.$NODE -P /xcatpost 2> /tmp/wget.log if [ "$?" = "0" ]; then - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "precreated mypostscript downloaded successfully" "/var/log/xcat/xcat.log" fi mv /xcatpost/mypostscript.$NODE /xcatpost/mypostscript @@ -104,7 +104,7 @@ export XCATSERVER # If mypostscript doesn't exist, we will get it through getpostscript.awk if [ ! -x /xcatpost/mypostscript ]; then - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "failed to download precreated mypostscript, trying to generate with getpostscript.awk" "/var/log/xcat/xcat.log" fi @@ -146,7 +146,7 @@ export PATH=$PATH:/xcatpost # use the run_ps subroutine to run the postscripts -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then echo "set -x" > /xcatpost/mypostscript else cat /dev/null > /xcatpost/mypostscript @@ -174,7 +174,7 @@ run_ps () { if [ -f \$1 ]; then echo \"\`date\` Running postscript: \$*\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` Running postscript: \$*\"" \"\$logfile\" - if [ \"\$XCATDEBUGMODE\" = \"1\" ]; then + if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then local compt=\$(file \$1) local reg=\"shell script\" if [[ \"\$compt\" =~ \$reg ]]; then @@ -207,7 +207,7 @@ run_ps () { " >> /xcatpost/mypostscript echo "$TMP" >> /xcatpost/mypostscript -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then echo "set +x" >> /xcatpost/mypostscript fi @@ -217,7 +217,7 @@ if [ ! -x /xcatpost/mypostscript ]; then updateflag $MASTER $XCATIPORT "installstatus failed" sleep 36500d else - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "generate mypostscript file successfully" "/var/log/xcat/xcat.log" fi fi @@ -229,11 +229,11 @@ echo "$TMP" > /xcatpost/mypostscript.post chmod 755 /xcatpost/mypostscript.post if [ ! -x /xcatpost/mypostscript.post ]; then - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "failed to generate /xcatpost/mypostscript.post" "/var/log/xcat/xcat.log" fi else - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "/xcatpost/mypostscript.post generated" "/var/log/xcat/xcat.log" fi fi @@ -246,11 +246,11 @@ EOF chmod 755 /etc/init.d/xcatpostinit1 if [ ! -x /etc/init.d/xcatpostinit1 ]; then - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "failed to generate /etc/init.d/xcatpostinit1" "/var/log/xcat/xcat.log" fi else - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "/etc/init.d/xcatpostinit1 generated" "/var/log/xcat/xcat.log" fi fi @@ -277,7 +277,7 @@ else fi #chkconfig --add xcatpostinit1 chkconfig xcatpostinit1 on - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 enabled" "/var/log/xcat/xcat.log" fi fi @@ -285,44 +285,39 @@ fi #create the xcatinstallpost mkdir -p /opt/xcat +cat >/opt/xcat/xcatinstallpost << 'EOF' + +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# + +if [ -f /xcatpost/mypostscript.post ]; then + RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` +fi + if [[ $OSVER == ubuntu* ]]; then -cat >/opt/xcat/xcatinstallpost << 'EOF' -#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# -if [ -f /xcatpost/mypostscript.post ]; then - RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` -fi -if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then - msgutil_r "$MASTER_IP" "debug" "update-rc.d -f xcatpostinit1 remove" "/var/log/xcat/xcat.log" - update-rc.d -f xcatpostinit1 remove -fi -echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo -EOF + if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then + update-rc.d -f xcatpostinit1 remove + fi + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then + msgutil_r "$MASTER_IP" "debug" "update-rc.d -f xcatpostinit1 remove" "/var/log/xcat/xcat.log" + fi else -cat >/opt/xcat/xcatinstallpost << 'EOF' - -#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# - -if [ -f /xcatpost/mypostscript.post ]; then - RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` + if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then + chkconfig xcatpostinit1 off + fi + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then + msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 disabled" "/var/log/xcat/xcat.log" + fi fi -if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then - chkconfig xcatpostinit1 off -fi - -if [ "$XCATDEBUGMODE" = "1" ]; then - msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 disabled" "/var/log/xcat/xcat.log" -fi EOF -fi chmod 755 /opt/xcat/xcatinstallpost if [ ! -x /opt/xcat/xcatinstallpost ]; then - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "failed to generate /opt/xcat/xcatinstallpost" "/var/log/xcat/xcat.log" fi else - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "/opt/xcat/xcatinstallpost generated" "/var/log/xcat/xcat.log" fi fi @@ -335,11 +330,11 @@ EOF chmod 755 /opt/xcat/xcatdsklspost if [ ! -x /opt/xcat/xcatdsklspost ]; then - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "failed to generate /opt/xcat/xcatdsklspost" "/var/log/xcat/xcat.log" fi else - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "/opt/xcat/xcatdsklspost generated" "/var/log/xcat/xcat.log" fi fi @@ -356,11 +351,11 @@ if [[ $OSVER != ubuntu* ]]; then addsiteyum fi -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "info" "running mypostscript" "/var/log/xcat/xcat.log" fi /xcatpost/mypostscript -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "info" "mypostscript returned" "/var/log/xcat/xcat.log" fi @@ -413,13 +408,13 @@ EOF else sed -i 's/^serial/#serial/' /boot/grub/grub.conf sed -i 's/^terminal/#terminal/' /boot/grub/grub.conf - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "/boot/grub/grub.conf updated" "/var/log/xcat/xcat.log" fi fi -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "info" "finished node installation, reporting status..." "/var/log/xcat/xcat.log" fi #the following command should always be run to prevent infinite installation loops @@ -427,6 +422,6 @@ updateflag.awk $MASTER 3002 cd / -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then set +x fi diff --git a/xCAT-server/share/xcat/install/scripts/pre.rh b/xCAT-server/share/xcat/install/scripts/pre.rh index 2d798cbc0..9dd9883f9 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rh +++ b/xCAT-server/share/xcat/install/scripts/pre.rh @@ -1,6 +1,5 @@ export XCATDEBUGMODE="#TABLEBLANKOKAY:site:key=xcatdebugmode:value#" -if [ "$XCATDEBUGMODE" != "0" ] && [ "$XCATDEBUGMODE" != "" ] -then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then set -x fi @@ -144,13 +143,13 @@ try: line = "installing prep" newSocket.send(line) break -#UNCOMMENONXCATDEBUGMODE# if(command[0] == "sh"): #DEBUG purposes only, wide open root priv command here. -#UNCOMMENONXCATDEBUGMODE# newcommand = "" -#UNCOMMENONXCATDEBUGMODE# for i in command[1:]: -#UNCOMMENONXCATDEBUGMODE# newcommand = newcommand + i + " " -#UNCOMMENONXCATDEBUGMODE# output = os.popen(newcommand).read() -#UNCOMMENONXCATDEBUGMODE# newSocket.send(output) -#UNCOMMENONXCATDEBUGMODE# break +#UNCOMMENTOENABLEDEBUGPORT# if(command[0] == "sh"): #DEBUG purposes only, wide open root priv command here. +#UNCOMMENTOENABLEDEBUGPORT# newcommand = "" +#UNCOMMENTOENABLEDEBUGPORT# for i in command[1:]: +#UNCOMMENTOENABLEDEBUGPORT# newcommand = newcommand + i + " " +#UNCOMMENTOENABLEDEBUGPORT# output = os.popen(newcommand).read() +#UNCOMMENTOENABLEDEBUGPORT# newSocket.send(output) +#UNCOMMENTOENABLEDEBUGPORT# break if(command[0] == "screendump"): newcommand = "cat /dev/vcs" for i in command[1:]: @@ -238,7 +237,6 @@ NEXTSERVER=${NEXTSERVER%%:*} export nextserver=$NEXTSERVER #INSTALL_SOURCES_IN_PRE# -if [ "$XCATDEBUGMODE" != "0" ] && [ "$XCATDEBUGMODE" != "" ] -then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then set +x fi diff --git a/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 b/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 index 7796c0239..36fb944b9 100755 --- a/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 +++ b/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 @@ -1,6 +1,5 @@ export XCATDEBUGMODE="#TABLEBLANKOKAY:site:key=xcatdebugmode:value#" -if [ "$XCATDEBUGMODE" != "0" ] && [ "$XCATDEBUGMODE" != "" ] -then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then set -x fi @@ -108,13 +107,13 @@ try: line = "installing prep" newSocket.send(line) break -#UNCOMMENONXCATDEBUGMODE# if(command[0] == "sh"): #DEBUG purposes only, wide open root priv command here. -#UNCOMMENONXCATDEBUGMODE# newcommand = "" -#UNCOMMENONXCATDEBUGMODE# for i in command[1:]: -#UNCOMMENONXCATDEBUGMODE# newcommand = newcommand + i + " " -#UNCOMMENONXCATDEBUGMODE# output = os.popen(newcommand).read() -#UNCOMMENONXCATDEBUGMODE# newSocket.send(output) -#UNCOMMENONXCATDEBUGMODE# break +#UNCOMMENTOENABLEDEBUGPORT# if(command[0] == "sh"): #DEBUG purposes only, wide open root priv command here. +#UNCOMMENTOENABLEDEBUGPORT# newcommand = "" +#UNCOMMENTOENABLEDEBUGPORT# for i in command[1:]: +#UNCOMMENTOENABLEDEBUGPORT# newcommand = newcommand + i + " " +#UNCOMMENTOENABLEDEBUGPORT# output = os.popen(newcommand).read() +#UNCOMMENTOENABLEDEBUGPORT# newSocket.send(output) +#UNCOMMENTOENABLEDEBUGPORT# break if(command[0] == "screendump"): newcommand = "cat /dev/vcs" for i in command[1:]: @@ -206,7 +205,6 @@ NEXTSERVER=${NEXTSERVER%%:*} export nextserver=$NEXTSERVER #INSTALL_SOURCES_IN_PRE# -if [ "$XCATDEBUGMODE" != "0" ] && [ "$XCATDEBUGMODE" != "" ] -then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then set +x fi diff --git a/xCAT-server/share/xcat/install/scripts/pre.sles b/xCAT-server/share/xcat/install/scripts/pre.sles index f42cabf40..600cc5829 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.sles +++ b/xCAT-server/share/xcat/install/scripts/pre.sles @@ -59,14 +59,14 @@ BEGIN { while(1) { ns |& getline -#UNCOMMENONXCATDEBUGMODE# if(\$1 == "sh") { #TODO: ENABLE IF DEBUG -#UNCOMMENONXCATDEBUGMODE# sub(/^sh +/,"",\$0) -#UNCOMMENONXCATDEBUGMODE# output = \$0 -#UNCOMMENONXCATDEBUGMODE# while((output | getline) > 0) -#UNCOMMENONXCATDEBUGMODE# print \$0 |& ns -#UNCOMMENONXCATDEBUGMODE# print "EOO" |& ns -#UNCOMMENONXCATDEBUGMODE# close(output) -#UNCOMMENONXCATDEBUGMODE# } +#UNCOMMENTOENABLEDEBUGPORT# if(\$1 == "sh") { #TODO: ENABLE IF DEBUG +#UNCOMMENTOENABLEDEBUGPORT# sub(/^sh +/,"",\$0) +#UNCOMMENTOENABLEDEBUGPORT# output = \$0 +#UNCOMMENTOENABLEDEBUGPORT# while((output | getline) > 0) +#UNCOMMENTOENABLEDEBUGPORT# print \$0 |& ns +#UNCOMMENTOENABLEDEBUGPORT# print "EOO" |& ns +#UNCOMMENTOENABLEDEBUGPORT# close(output) +#UNCOMMENTOENABLEDEBUGPORT# } if(\$1 == "screendump") { output = "chvt " \$2 ";cat /dev/vcs" diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu b/xCAT-server/share/xcat/install/scripts/pre.ubuntu index e7189d640..edbf17beb 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu @@ -1,5 +1,5 @@ export XCATDEBUGMODE="#TABLEBLANKOKAY:site:key=xcatdebugmode:value#" -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then set -x fi @@ -95,11 +95,11 @@ fi read cmd arg remainder case "\$cmd" in -#UNCOMMENONXCATDEBUGMODE# "sh") #TODO: ENABLE IF DEBUG -#UNCOMMENONXCATDEBUGMODE# output=\$(eval \$arg \$remainder) -#UNCOMMENONXCATDEBUGMODE# echo "\$output" -#UNCOMMENONXCATDEBUGMODE# echo "EOO" -#UNCOMMENONXCATDEBUGMODE# ;; +#UNCOMMENTOENABLEDEBUGPORT# "sh") #TODO: ENABLE IF DEBUG +#UNCOMMENTOENABLEDEBUGPORT# output=\$(eval \$arg \$remainder) +#UNCOMMENTOENABLEDEBUGPORT# echo "\$output" +#UNCOMMENTOENABLEDEBUGPORT# echo "EOO" +#UNCOMMENTOENABLEDEBUGPORT# ;; "screendump") output=\$(eval chvt \$arg; cat /dev/vcs) @@ -206,7 +206,7 @@ echo " ." >> /tmp/partitionfile #XCA_PARTMAN_ADDITIONAL_CONFIG_SCRIPT# exit 0 -if [ "$XCATDEBUGMODE" = "1" ]; then +if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then then set +x fi diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 index 9a92ba14a..81d44053a 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 @@ -90,11 +90,11 @@ fi read cmd arg remainder case "\$cmd" in -#UNCOMMENONXCATDEBUGMODE# "sh") #TODO: ENABLE IF DEBUG -#UNCOMMENONXCATDEBUGMODE# output=\$(eval \$arg \$remainder) -#UNCOMMENONXCATDEBUGMODE# echo "\$output" -#UNCOMMENONXCATDEBUGMODE# echo "EOO" -#UNCOMMENONXCATDEBUGMODE# ;; +#UNCOMMENTOENABLEDEBUGPORT# "sh") #TODO: ENABLE IF DEBUG +#UNCOMMENTOENABLEDEBUGPORT# output=\$(eval \$arg \$remainder) +#UNCOMMENTOENABLEDEBUGPORT# echo "\$output" +#UNCOMMENTOENABLEDEBUGPORT# echo "EOO" +#UNCOMMENTOENABLEDEBUGPORT# ;; "screendump") output=\$(eval chvt \$arg; cat /dev/vcs) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 6dd32a794..cf7739aca 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -12,10 +12,10 @@ d-i keyboard-configuration/layoutcode string en # Use the following settings if you wish to make use of the network-console # component for remote installation over SSH. This only makes sense if you # intend to perform the remainder of the installation manually. -#UNCOMMENONXCATDEBUGMODE# d-i anna/choose_modules string network-console +#UNCOMMENTOENABLESSH# d-i anna/choose_modules string network-console #d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key -#UNCOMMENONXCATDEBUGMODE# d-i network-console/password password cluster -#UNCOMMENONXCATDEBUGMODE# d-i network-console/password-again password cluster +#UNCOMMENTOENABLESSH# d-i network-console/password password cluster +#UNCOMMENTOENABLESSH# d-i network-console/password-again password cluster diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 098980e7d..e58e34264 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -58,7 +58,7 @@ echolog() if [ "$VERBOSE" = "1" ]; then echo "$msgstr" fi - if [ "$XCATDEBUGMODE" = "1" ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "$msgtype" "$msgstr" "/var/log/xcat/xcat.log" fi else @@ -828,7 +828,7 @@ run_ps () { if [ -f \$1 ]; then echo \"\`date\` Running postscript: \$*\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` Running postscript: \$*\"" \"\$logfile\" - if [ \"\$XCATDEBUGMODE\" = \"1\" ]; then + if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then local compt=\$(file \$1) local reg=\"shell script\" if [[ \"\$compt\" =~ \$reg ]]; then diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 1c137854b..0eee2be6a 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -9,6 +9,7 @@ if [ -f /xcatpost/mypostscript.post ]; then XCATDEBUGMODE=`grep 'XCATDEBUGMODE=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` MASTER_IP=`grep '^MASTER_IP=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` + OSVER=`grep '^OSVER=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` fi @@ -85,12 +86,12 @@ if [ -z "$CNS" ] || [ "$CNS" != "'0'" -a "$CNS" != "'N'" -a "$CNS" != "'n'" echo " if [ \"\$return_value\" -eq \"0\" ]; then - if [ \"\$XCATDEBUGMODE\" > \"0\" ]; then + if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then msgutil_r \"\$MASTER_IP\" \"info\" \"node booted, reporting status...\" \"/var/log/xcat/xcat.log\" fi updateflag.awk \$MASTER 3002 \"installstatus booted\" else - if [ \"\$XCATDEBUGMODE\" > \"0\" ]; then + if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then msgutil_r \"\$MASTER_IP\" \"info\" \"node boot failed, reporting status...\" \"/var/log/xcat/xcat.log\" fi updateflag.awk \$MASTER 3002 \"installstatus failed\"