Changeset 1289 for trunk/tools/datacenter/vzImport.sh
- Timestamp:
- 03/20/10 09:16:51 (2 years ago)
- Files:
-
- 1 modified
-
trunk/tools/datacenter/vzImport.sh (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/datacenter/vzImport.sh
r1288 r1289 14 14 # The first step was faking the new node on the source system 15 15 # and running clone wizard after setting up the ssh stuff. 16 # 17 #TODO 18 # We need to get the actual MySQL query results to determine 19 # if something wrong or unexpected happened. 16 20 # 17 21 … … 65 69 echo ""; 66 70 67 #this is a nested read see do above68 read -e -p "Commit $cHostname [y/n/s/q]?: " cReply < /dev/tty;69 if [ "$cReply" == "n" ];then70 echo "Aborting commit and exiting $0";71 exit 0;72 fi73 if [ "$cReply" == "s" ];then74 echo "Skipping $cHostname";75 echo "";76 continue;77 fi78 if [ "$cReply" != "y" ];then79 echo "Aborting commit and exiting $0";80 exit 0;81 fi82 83 echo "Commiting to tContainer";84 85 71 cQuery="SELECT uIP FROM tIP WHERE cLabel='$cIP' AND uAvailable=1"; 86 72 uIPv4=`echo $cQuery | /usr/bin/mysql -pwsxedc -u unxsvz unxsvz | tail -n 1 | awk -F' ' '{print $1}'`; … … 108 94 109 95 cQuery="SELECT uContainer FROM tContainer WHERE cLabel='$cLabel' AND uDatacenter=$uDatacenter AND uNode=$uNode"; 110 uC ontainer=`echo $cQuery | /usr/bin/mysql -pwsxedc -u unxsvz unxsvz | tail -n 1 | awk -F' ' '{print $1}'`;96 uCheckContainer=`echo $cQuery | /usr/bin/mysql -pwsxedc -u unxsvz unxsvz | tail -n 1 | awk -F' ' '{print $1}'`; 111 97 if [ $? != 0 ];then 112 98 echo "$cQuery failed"; 113 99 exit 1; 114 100 fi 115 echo uC ontainer=$uContainer;101 echo uCheckContainer=$uCheckContainer; 116 102 117 if [ "$uC ontainer" != "" ];then103 if [ "$uCheckContainer" != "" ];then 118 104 echo "Skipping container cLabel=$cLabel cHostname=$cHostname already in tContainer"; 119 105 echo ""; … … 121 107 fi 122 108 123 #debug only 124 #echo ""; 125 #continue; 109 #this is a nested read see do above 110 read -e -p "Commit $cHostname [y/n/s/q]?: " cReply < /dev/tty; 111 if [ "$cReply" == "n" ];then 112 echo "Aborting commit and exiting $0"; 113 exit 0; 114 fi 115 if [ "$cReply" == "s" ];then 116 echo "Skipping $cHostname"; 117 echo ""; 118 continue; 119 fi 120 if [ "$cReply" != "y" ];then 121 echo "Aborting commit and exiting $0"; 122 exit 0; 123 fi 124 125 echo "Commiting to tContainer"; 126 126 127 127 cQuery="INSERT INTO tContainer SET uContainer=$uContainer,cLabel='$cLabel',cHostname='$cHostname',uIPv4=$uIPv4,uOSTemplate=$uOSTemplate,uConfig=$uConfig,uNameserver=$uNameserver,uSearchdomain=$uSearchdomain,uDatacenter=$uDatacenter,uNode=$uNode,uStatus=$uStatus,uOwner=$uOwner,uCreatedBy=$uCreatedBy,uCreatedDate=UNIX_TIMESTAMP(NOW())"; … … 133 133 echo $cResult; 134 134 135 cQuery="UPDATE tIP SET uAvailable=0 WHERE uIP v4=$uIPv4";135 cQuery="UPDATE tIP SET uAvailable=0 WHERE uIP=$uIPv4"; 136 136 cResult=`echo $cQuery | /usr/bin/mysql -pwsxedc -u unxsvz unxsvz | tail -n 1`; 137 137 if [ $? != 0 ];then … … 140 140 fi 141 141 echo $cResult; 142 echo "Commit ed";142 echo "Commit attempted"; 143 143 echo ""; 144 144 done
