From a37c3e108415aaaf22226d1597ec3d2b49c3423e Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Mon, 27 Jul 2009 21:59:21 +0000 Subject: [PATCH] * Added OS detection for VPC, VMware and LiveCD to helpers.whichOS() svn path=/trunk/qa/; revision=138775 --- common/helpers.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/common/helpers.py b/common/helpers.py index cfa04f5..cf25549 100644 --- a/common/helpers.py +++ b/common/helpers.py @@ -3,6 +3,7 @@ import sys import os import subprocess +import pdb myTestopia = None @@ -30,7 +31,25 @@ def whichOS(): if sys.platform == 'win32': return 'win32' elif sys.platform == 'linux2': - return 'linux' + if os.path.isfile("/studio/profile"): + # this will determine if it's running on vpc + moboMaker = executeCmd("hal-device computer | grep system.board.vendor")[0].strip() + + # this tells us what type if image kiwi created (VM or LiveCD) + for curLine in open("/studio/profile").readlines(): + if "kiwi_type=" in curLine: + kiwiType = curLine.split("=")[1].strip().strip("\"") + + if moboMaker == "system.board.vendor = 'Microsoft Corporation' (string)" and kiwiType == "vmx": + return 'vpc' + elif kiwiType == "iso": + return 'livecd' + elif kiwiType == "vmx": + return 'vmware' + else: + raise Exception("Couldn't determine the type of kiwi created image I'm running on.") + else: + return 'linux' elif sys.platform == 'darwin': return 'macos'