change the method for judge python version which use to run waagent

This commit is contained in:
Nidylei 2015-09-09 12:01:20 +08:00
Родитель 3388a91445
Коммит 63ec8dd12a
3 изменённых файлов: 17 добавлений и 13 удалений

Просмотреть файл

@ -16,8 +16,7 @@ while echo $1 | grep ^- > /dev/null; do
shift
done
if [ -e /etc/debian_version ]; then
#echo "UBUNTU"
echo `python -c 'import platform;print platform.dist()[0]+ platform.dist()[1]'`
echo "UBUNTU"
exitVal=0
elif [ -e /etc/redhat-release ]; then
tmp=`cat /etc/redhat-release`

Просмотреть файл

@ -79,10 +79,6 @@ Function DetectLinuxDistro($VIP, $SSHport, $testVMUser, $testVMPassword)
}
else
{
if ($DistroName -imatch "Ubuntu15.10")
{
$CleanedDistroName = "Ubuntu15.10"
}
elseif ($DistroName -imatch "UBUNTU")
{
$CleanedDistroName = "UBUNTU"

Просмотреть файл

@ -64,19 +64,28 @@ if ($isDeployed)
if($SetupStatus -imatch "PACKAGE-INSTALL-CONFIG-PASS")
{
LogMsg "** All the required packages for the distro installed successfully **"
#VM De-provision
#Check whether the distro is using python2 and python3 to run waagent
$usePython3 = $false
$output = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "ps aux | grep waagent | grep python | grep -v 'ps aux | grep waagent | grep python'" -runAsSudo
if($output -match 'python3')
{
$usePython3 = $true
}
#VM De-provision
if ($DistroName -eq "COREOS")
{
$output = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "/usr/share/oem/python/bin/python /usr/share/oem/bin/waagent -force -deprovision+user 2>&1" -runAsSudo
}
elseif ($DistroName -eq "Ubuntu15.10"){
GetVMLogs -DeployedServices $isDeployed
$output = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "/usr/bin/python3 /usr/sbin/waagent -force -deprovision+user 2>&1" -runAsSudo
}
else {
GetVMLogs -DeployedServices $isDeployed
$output = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "/usr/sbin/waagent -force -deprovision+user 2>&1" -runAsSudo
if($usePython3)
{
$output = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "/usr/bin/python3 /usr/sbin/waagent -force -deprovision+user 2>&1" -runAsSudo
}
else
{
$output = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "/usr/sbin/waagent -force -deprovision+user 2>&1" -runAsSudo
}
}
if($output -match "home directory will be deleted")