Wei updated code based on Liz's feedback

This commit is contained in:
unknown 2015-04-21 16:11:57 +08:00
Родитель 581cf6eb90
Коммит e542a15914
5 изменённых файлов: 46 добавлений и 45 удалений

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

@ -5,37 +5,15 @@ from azuremodules import *
def RunTest():
UpdateState("TestRunning")
RunLog.info("Checking if root password is deleted or not...")
passwd_output = Run("cat /etc/shadow | grep root")
root_passwd = passwd_output.split(":")[1]
if (IsUbuntu()):
if ('*' in root_passwd or '!' in root_passwd):
RunLog.info('root password is deleted in /etc/shadow in Ubuntu.')
ResultLog.info('PASS')
else:
RunLog.info('root password is not deleted in /etc/shadow in Ubuntu.')
ResultLog.info('FAIL')
root_passwd = passwd_output.split(":")[1]
if ('*' in root_passwd or '!' in root_passwd):
RunLog.info('root password is deleted in /etc/shadow.')
ResultLog.info('PASS')
else:
RunLog.info("Read Provisioning.DeleteRootPassword from /etc/waagent.conf..")
outputlist=open("/etc/waagent.conf")
for line in outputlist:
if(line.find("Provisioning.DeleteRootPassword")!=-1):
break
RunLog.error('root password not deleted.%s', passwd_output)
ResultLog.error('FAIL')
UpdateState("TestCompleted")
RunLog.info("Value ResourceDisk.DeleteRootPassword in /etc/waagent.conf.." + line.strip()[-1])
if (('*' in root_passwd or '!' in root_passwd) and (line.strip()[-1] == "y")):
RunLog.info('root password is deleted in /etc/shadow.')
ResultLog.info('PASS')
elif(not('*' in root_passwd or '!' in root_passwd) and (line.strip()[-1] == "n")):
RunLog.info('root password is not deleted in /etc/shadow.')
ResultLog.info('PASS')
if (('*' in root_passwd or '!' in root_passwd) and (line.strip()[-1] == "n")):
RunLog.error('root password is deleted. Expected not deleted %s', passwd_output)
ResultLog.error('FAIL')
elif(not('*' in root_passwd or '!' in root_passwd) and (line.strip()[-1] == "y")):
RunLog.error('root password not deleted. Expected deleted %s', passwd_output)
ResultLog.error('FAIL')
UpdateState("TestCompleted")
RunTest()
RunTest()

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

@ -1,6 +1,7 @@
#!/usr/bin/python
from azuremodules import *
import os.path
def RunTest(command):
UpdateState("TestRunning")
@ -8,14 +9,20 @@ def RunTest(command):
RunLog.info("Executing swapon -s..")
temp = Run(command)
output = temp
RunLog.info("Read ResourceDisk.EnableSwap from /etc/waagent.conf..")
outputlist=open("/etc/waagent.conf")
if os.path.exists("/etc/lsb-release") and int(Run("cat /etc/lsb-release | grep -i coreos | wc -l")) > 0:
waagent_conf_file = "/usr/share/oem/waagent.conf"
else:
waagent_conf_file = "/etc/waagent.conf"
RunLog.info("Read ResourceDisk.EnableSwap from " + waagent_conf_file + "..")
outputlist=open(waagent_conf_file)
for line in outputlist:
if(line.find("ResourceDisk.EnableSwap")!=-1):
break
RunLog.info("Value ResourceDisk.EnableSwap in /etc/waagent.conf.." + line.strip()[-1])
RunLog.info("Value ResourceDisk.EnableSwap in " + waagent_conf_file + ": " + line.strip()[-1])
if (("swap" in output) and (line.strip()[-1] == "n")):
RunLog.error('Swap is enabled. Swap should not be enabled.')
RunLog.error('%s', output)
@ -24,15 +31,26 @@ def RunTest(command):
elif ((output.find("swap")==-1) and (line.strip()[-1] == "y")):
RunLog.error('Swap is disabled. Swap should be enabled.')
RunLog.error('%s', output)
RunLog.info("Pleae check value of setting ResourceDisk.SwapSizeMB")
ResultLog.error('FAIL')
elif(("swap" in output) and (line.strip()[-1] == "y")):
RunLog.info('swap is enabled.')
ResultLog.info('PASS')
elif ((output.find("swap")==-1) and (line.strip()[-1] == "n")):
if(IsUbuntu()) :
mntresource = "/mnt"
else:
mntresource = "/mnt/resource"
swapfile = mntresource + "/swapfile"
if(swapfile in output):
RunLog.info("swap is enabled on resource disk")
ResultLog.info('PASS')
else:
RunLog.info("swap is not enabled on resource disk")
ResultLog.info('FAIL')
elif((output.find("swap")==-1) and (line.strip()[-1] == "n")):
RunLog.info('swap is disabled.')
ResultLog.info('PASS')
UpdateState("TestCompleted")
RunTest("swapon -s")

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

@ -52,7 +52,7 @@ if ($isDeployed)
}
if ($detectedDistro -imatch "COREOS")
{
$matchstrings = @("_TEST_GRUB_VERIFICATION_SUCCESS","_TEST_UDEV_RULES_SUCCESS")
$matchstrings = @("_TEST_UDEV_RULES_SUCCESS")
}
RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files $currentTestData.files -username $user -password $password -upload

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

@ -35,11 +35,14 @@ def verify_grub(distro):
if distro == "UBUNTU":
grub_out = Run("cat /etc/default/grub")
if distro == "SUSE":
suse_ver = Run("cat /etc/SuSE-release | grep -i version | awk -F ' ' '{print $3}' | tr -d '\n'")
if suse_ver == "13.2":
if os.path.exists("/boot/grub2/grub.cfg"):
grub_out = Run("cat /boot/grub2/grub.cfg")
if suse_ver == "13.1":
elif os.path.exists("/boot/grub/grub.conf"):
grub_out = Run("cat /boot/grub/grub.conf")
else:
RunLog.error("Unable to locate grub file")
print(distro+"_TEST_GRUB_VERIFICATION_FAIL")
return False
if distro == "CENTOS" or distro == "ORACLELINUX" or distro == "REDHAT" or distro == "SLES" or distro == "FEDORA":
if os.path.isfile("/boot/grub2/grub.cfg"):
RunLog.info("Getting Contents of /boot/grub2/grub.cfg")
@ -55,7 +58,7 @@ def verify_grub(distro):
#in core os we don't have access to boot partition
grub_out = Run("dmesg")
if "console=ttyS0" in grub_out and "rootdelay=300" in grub_out and "libata.atapi_enabled=0" not in grub_out and "reserve=0x1f0,0x8" not in grub_out:
if distro == "CENTOS" or distro == "ORACLELINUX":
if distro == "CENTOS" or distro == "ORACLELINUX" or distro == "REDHAT":
# check numa=off in grub for CentOS 6.x and Oracle Linux 6.x
version_release = Run("cat /etc/system-release | grep -o [0-9].[0-9] | head -1 | tr -d '\n'")
if float(version_release) < 7.0:
@ -328,6 +331,6 @@ if distro == "SLES":
RunLog.info("DHCLIENT_SET_HOSTNAME='no' not present in /etc/sysconfig/network/dhcp, it's not strict.")
if distro == "COREOS":
#"rootdelay=300" has issues with CoreOS which causes extra long boot time
#"rootdelay=300" has issues with CoreOS which causes extra long boot time
#result = verify_grub(distro)
result = verify_udev_rules(distro)

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

@ -5,6 +5,8 @@
<keywords>Fast TSC calibration</keywords>
<keywords>acpi PNP0A03:00</keywords>
<keywords>systemd-journald-audit.socket</keywords>
<keywords>Failed to set file attributes: Inappropriate ioctl for device</keywords>
<keywords>Failed to create new system journal: No such file or directory</keywords>
</failures>
<errors/>
<warnings/>