def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Handle asType and asOsArches specially. if sAttr == 'sType': (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); if sError is None: if len(self.asTypes) <= 0: oNewValue = None; else: for sType in oNewValue: if len(sType) < 2 or sType.lower() != sType: if sError is None: sError = ''; else: sError += ', '; sError += 'invalid value "%s"' % (sType,); elif sAttr == 'asOsArches': (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull, asValidValues = coreconsts.g_kasOsDotCpusAll); if sError is not None and oNewValue is not None: oNewValue = sorted(oNewValue); # Must be sorted! elif sAttr == 'cSecMaxAge' and oValue not in aoNilValues: # Allow human readable interval formats. (oNewValue, sError) = utils.parseIntervalSeconds(oValue); else: return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); return (oNewValue, sError);
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idTestSet = None; self.tsConfig = None; self.tsCreated = None; self.tsDone = None; self.enmStatus = 'running'; self.idBuild = None; self.idBuildCategory = None; self.idBuildTestSuite = None; self.idGenTestBox = None; self.idTestBox = None; self.idSchedGroup = None; self.idTestGroup = None; self.idGenTestCase = None; self.idTestCase = None; self.idGenTestCaseArgs = None; self.idTestCaseArgs = None; self.idTestResult = None; self.sBaseFilename = None; self.iGangMemberNo = 0; self.idTestSetGangLeader = None;
def getEffectiveDateParam(self, sParamName = None): """ Gets the effective date parameter. Returns a timestamp suitable for database and url parameters. Returns None if not found or empty. The first call with sParamName set to None will set the internal _tsNow value upon successfull return. """ sName = sParamName if sParamName is not None else WuiDispatcherBase.ksParamEffectiveDate if sName not in self._dParams: return None; if sName not in self._asCheckedParams: self._asCheckedParams.append(sName); sValue = self._dParams[sName]; if isinstance(sValue, list): raise WuiException('%s parameter "%s" is given multiple times: %s' % (self._sAction, sName, sValue)); sValue = sValue.strip(); if sValue == '': return None; # # Timestamp, just validate it and return. # if sValue[0] not in ['-', '+']: (sValue, sError) = ModelDataBase.validateTs(sValue); if sError is not None: raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError)); if sParamName is None and self._tsNow is None: self._tsNow = sValue; return sValue; # # Relative timestamp. Validate and convert it to a fixed timestamp. # chSign = sValue[0]; (sValue, sError) = ModelDataBase.validateTs(sValue[1:]); if sError is not None: raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError)); if sValue[-6] in ['-', '+']: raise WuiException('%s parameter "%s" ("%s") is a relative timestamp but incorrectly includes a time zone.' % (self._sAction, sName, sValue)); offTime = 11; if sValue[offTime - 1] != ' ': raise WuiException('%s parameter "%s" ("%s") incorrect format.' % (self._sAction, sName, sValue)); sInterval = 'P' + sValue[:(offTime - 1)] + 'T' + sValue[offTime:]; self._oDb.execute('SELECT CURRENT_TIMESTAMP ' + chSign + ' \'' + sInterval + '\'::INTERVAL'); oDate = self._oDb.fetchOne()[0]; sValue = str(oDate); if sParamName is None and self._tsNow is None: self._tsNow = sValue; return sValue;
def __init__(self): ModelDataBase.__init__(self); self.idTestBox = None; self.idSchedGroup = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.iSchedPriority = 16;
def __init__(self): ModelDataBase.__init__(self) self.idTestResult = None self.tsEffective = None self.tsExpire = None self.uidAuthor = None self.idTestSet = None self.idFailureReason = None self.sComment = None
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.tsCreated = None; self.sEvent = None; self.sLogText = None;
def __init__(self): """Init parameters""" ModelDataBase.__init__(self); self.uid = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.sUsername = None; self.sEmail = None; self.sFullName = None; self.sLoginName = None;
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Custom handling of the email field. if sAttr == 'sEmail': return ModelDataBase.validateEmail(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull); # Automatically lowercase the login name if we're supposed to do case # insensitive matching. (The feature assumes lower case in DB.) if sAttr == 'sLoginName' and oValue is not None and config.g_kfLoginNameCaseInsensitive: oValue = oValue.lower(); return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idTestBox = None; self.idGenTestBox = None; self.tsUpdated = None; self.enmState = self.ksTestBoxState_Idle; self.idTestSet = None;
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.sRepository = None; self.iRevision = None; self.tsCreated = None; self.sAuthor = None; self.sMessage = None;
def getEffectiveDateParam(self, sParamName=None): """ Gets the effective date parameter. Returns a timestamp suitable for database and url parameters. Returns None if not found or empty. """ sName = sParamName if sParamName is not None else WuiDispatcherBase.ksParamEffectiveDate if sName not in self._dParams: return None if sName not in self._asCheckedParams: self._asCheckedParams.append(sName) sValue = self._dParams[sName] if isinstance(sValue, list): raise WuiException('%s parameter "%s" is given multiple times: %s' % (self._sAction, sName, sValue)) sValue = sValue.strip() if sValue == "": return None # # Timestamp, just validate it and return. # if sValue[0] not in ["-", "+"]: (sValue, sError) = ModelDataBase.validateTs(sValue) if sError is not None: raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError)) return sValue # # Relative timestamp. Validate and convert it to a fixed timestamp. # chSign = sValue[0] (sValue, sError) = ModelDataBase.validateTs(sValue[1:]) if sError is not None: raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError)) if sValue[-6] in ["-", "+"]: raise WuiException( '%s parameter "%s" ("%s") is a relative timestamp but incorrectly includes a time zone.' % (self._sAction, sName, sValue) ) offTime = 11 if sValue[offTime - 1] != " ": raise WuiException('%s parameter "%s" ("%s") incorrect format.' % (self._sAction, sName, sValue)) sInterval = "P" + sValue[: (offTime - 1)] + "T" + sValue[offTime:] self._oDb.execute("SELECT CURRENT_TIMESTAMP " + chSign + " '" + sInterval + "'::INTERVAL") oDate = self._oDb.fetchOne()[0] return str(oDate)
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idBuildCategory = None; self.sProduct = None; self.sRepository = None; self.sBranch = None; self.sType = None; self.asOsArches = None;
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idTestGroup = None self.tsEffective = None self.tsExpire = None self.uidAuthor = None self.sName = None self.sDescription = None
def __init__(self): ModelDataBase.__init__(self) # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idTestGroup = None; self.idTestCase = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.iSchedPriority = 16; self.aidTestCaseArgs = None;
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idFailureCategory = None self.tsEffective = None self.tsExpire = None self.uidAuthor = None self.sShort = None self.sFull = None
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idGlobalRsrc = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.sName = None; self.sDescription = None; self.fEnabled = False
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idSchedGroup = None; self.idTestGroup = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.iSchedPriority = 16; self.bmHourlySchedule = None; self.idTestGroupPreReq = None;
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idTestBox = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.idGenTestBox = None; self.ip = None; self.uuidSystem = None; self.sName = None; self.idStrDescription = None; self.fEnabled = False; self.enmLomKind = self.ksLomKind_None; self.ipLom = None; self.pctScaleTimeout = 100; self.idStrComment = None; self.idStrOs = None; self.idStrOsVersion = None; self.idStrCpuVendor = None; self.idStrCpuArch = None; self.idStrCpuName = None; self.lCpuRevision = None; self.cCpus = 1; self.fCpuHwVirt = False; self.fCpuNestedPaging = False; self.fCpu64BitGuest = False; self.fChipsetIoMmu = False; self.fRawMode = None; self.cMbMemory = 1; self.cMbScratch = 0; self.idStrReport = None; self.iTestBoxScriptRev = 0; self.iPythonHexVersion = 0; self.enmPendingCmd = self.ksTestBoxCmd_None; # String table values. self.sDescription = None; self.sComment = None; self.sOs = None; self.sOsVersion = None; self.sCpuVendor = None; self.sCpuArch = None; self.sCpuName = None; self.sReport = None;
def getAttributeParamNullValues(self, sAttr): aoNilValues = ModelDataBase.getAttributeParamNullValues(self, sAttr); if sAttr == 'cSecTimeout': aoNilValues.insert(0, ''); # Prettier NULL value for cSecTimeout. elif sAttr == 'sArgs': aoNilValues = []; # No NULL value here, thank you. return aoNilValues;
def getAttributeParamNullValues(self, sAttr): # Arrays default to [] as NULL currently. That doesn't work for us. if sAttr == 'aidTestCaseArgs': aoNilValues = [None, '-1']; else: aoNilValues = ModelDataBase.getAttributeParamNullValues(self, sAttr); return aoNilValues;
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idSchedGroup = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.sName = None; self.sDescription = None; self.fEnabled = None; self.enmScheduler = SchedGroupData.ksScheduler_BestEffortContinousItegration; self.idBuildSrc = None; self.idBuildSrcTestSuite = None;
def __init__(self): """Initialize""" ModelDataBase.__init__(self) self.idTestSet = None self.idBuildCategory = None self.sProduct = None self.sRepository = None self.sBranch = None self.sType = None self.idBuild = None self.sVersion = None self.iRevision = None self.sOs = None self.sOsVersion = None self.sArch = None self.sCpuVendor = None self.sCpuName = None self.cCpus = None self.fCpuHwVirt = None self.fCpuNestedPaging = None self.fCpu64BitGuest = None self.idTestBox = None self.sTestBoxName = None self.tsCreated = None self.tsElapsed = None self.enmStatus = None self.cErrors = None self.idTestCase = None self.sTestCaseName = None self.sBaseCmd = None self.sArgs = None self.sSubName = None self.idBuildTestSuite = None self.iRevisionTestSuite = None self.oFailureReason = None self.oFailureReasonAssigner = None self.tsFailureReasonAssigned = None self.sFailureReasonComment = None
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idBuild = None; self.tsCreated = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.idBuildCategory = None; self.iRevision = None; self.sVersion = None; self.sLogUrl = None; self.sBinaries = None; self.fBinariesDeleted = False;
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Handle sType and asOsArches specially. if sAttr == 'sType': (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); if sError is None and self.sType.lower() != self.sType: sError = 'Invalid build type value'; elif sAttr == 'asOsArches': (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull, asValidValues = coreconsts.g_kasOsDotCpusAll); if sError is not None and oNewValue is not None: oNewValue = sorted(oNewValue); # Must be sorted! else: return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); return (oNewValue, sError);
def _validateAndConvertWorker(self, asAllowNullAttributes, oDb, enmValidateFor = ModelDataBase.ksValidateFor_Other): # Override to do extra ipLom checks. dErrors = ModelDataBase._validateAndConvertWorker(self, asAllowNullAttributes, oDb, enmValidateFor); if self.ksParam_ipLom not in dErrors \ and self.ksParam_enmLomKind not in dErrors \ and self.enmLomKind != self.ksLomKind_None \ and self.ipLom is None: dErrors[self.ksParam_ipLom] = 'Light-out-management IP is mandatory and a LOM is selected.' return dErrors;
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idTestCase = None; self.idTestCaseArgs = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.idGenTestCaseArgs = None; self.sArgs = ''; self.cSecTimeout = None; self.sTestBoxReqExpr = None; self.sBuildReqExpr = None; self.cGangMembers = 1;
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idBlacklisting = None self.tsEffective = None self.tsExpire = None self.uidAuthor = None self.idFailureReason = None self.sProduct = None self.sBranch = None self.asTypes = None self.asOsArches = None self.iFirstRevision = None self.iLastRevision = None
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): if sAttr == 'cSecTimeout' and oValue not in aoNilValues: # Allow human readable interval formats. return utils.parseIntervalSeconds(oValue); (oValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); if sError is None: if sAttr == 'sTestBoxReqExpr': sError = TestCaseData.validateTestBoxReqExpr(oValue); elif sAttr == 'sBuildReqExpr': sError = TestCaseData.validateBuildReqExpr(oValue); return (oValue, sError);
def __init__(self): ModelDataBase.__init__(self); # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idBuildSrc = None; self.tsEffective = None; self.tsExpire = None; self.uidAuthor = None; self.sName = None; self.sDescription = None; self.sProduct = None; self.sBranch = None; self.asTypes = None; self.asOsArches = None; self.iFirstRevision = None; self.iLastRevision = None; self.cSecMaxAge = None;
def __init__(self): ModelDataBase.__init__(self) # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idBuildSrc = None self.tsEffective = None self.tsExpire = None self.uidAuthor = None self.sName = None self.sDescription = None self.sProduct = None self.sBranch = None self.asTypes = None self.asOsArches = None self.iFirstRevision = None self.iLastRevision = None self.cSecMaxAge = None
def _validateAndConvertWorker(self, asAllowNullAttributes, oDb): # Override to do extra ipLom checks. dErrors = ModelDataBase._validateAndConvertWorker( self, asAllowNullAttributes, oDb) if self.ksParam_ipLom not in dErrors \ and self.ksParam_enmLomKind not in dErrors \ and self.enmLomKind != self.ksLomKind_None \ and self.ipLom is None: dErrors[ self. ksParam_ipLom] = 'Light-out-management IP is mandatory and a LOM is selected.' return dErrors
def getTsParam(self, sName, tsDefault=None, fRequired=True): """ Gets a timestamp parameter. Raises exception if not found and fRequired is True. """ if fRequired is False and sName not in self._dParams: return tsDefault sValue = self.getStringParam(sName, None, None if tsDefault is None else str(tsDefault)) (sValue, sError) = ModelDataBase.validateTs(sValue) if sError is not None: raise WuiException('%s parameter %s value "%s": %s' % (self._sAction, sName, sValue, sError)) return sValue
def __init__(self): ModelDataBase.__init__(self) # # Initialize with defaults. # See the database for explanations of each of these fields. # self.idTestBox = None self.tsEffective = None self.tsExpire = None self.uidAuthor = None self.idGenTestBox = None self.ip = None self.uuidSystem = None self.sName = None self.sDescription = None self.idSchedGroup = 1 self.fEnabled = False self.enmLomKind = self.ksLomKind_None self.ipLom = None self.pctScaleTimeout = 100 self.sOs = None self.sOsVersion = None self.sCpuVendor = None self.sCpuArch = None self.sCpuName = None self.lCpuRevision = None self.cCpus = 1 self.fCpuHwVirt = False self.fCpuNestedPaging = False self.fCpu64BitGuest = False self.fChipsetIoMmu = False self.cMbMemory = 1 self.cMbScratch = 0 self.sReport = None self.iTestBoxScriptRev = 0 self.iPythonHexVersion = 0 self.enmPendingCmd = self.ksTestBoxCmd_None
def getTsParam(self, sName, tsDefault = None, fRequired = True): """ Gets a timestamp parameter. Raises exception if not found and fRequired is True. """ if fRequired is False and sName not in self._dParams: return tsDefault; sValue = self.getStringParam(sName, None, None if tsDefault is None else str(tsDefault)); (sValue, sError) = ModelDataBase.validateTs(sValue); if sError is not None: raise WuiException('%s parameter %s value "%s": %s' % (self._sAction, sName, sValue, sError)); return sValue;
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Handle sType and asOsArches specially. if sAttr == 'sType': (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute( self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb) if sError is None and self.sType.lower() != self.sType: sError = 'Invalid build type value' elif sAttr == 'asOsArches': (oNewValue, sError) = self.validateListOfStr( oValue, aoNilValues=aoNilValues, fAllowNull=fAllowNull, asValidValues=coreconsts.g_kasOsDotCpusAll) if sError is not None and oNewValue is not None: oNewValue = sorted(oNewValue) # Must be sorted! else: return ModelDataBase._validateAndConvertAttribute( self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb) return (oNewValue, sError)
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): if sAttr != 'aidTestCaseArgs': return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); # -1 is a special value, which when present make the whole thing NULL (None). (aidVariations, sError) = self.validateListOfInts(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull, iMin = -1, iMax = 0x7ffffffe); if sError is None: if aidVariations is None: pass; elif -1 in aidVariations: aidVariations = None; elif 0 in aidVariations: sError = 'Invalid test case varation ID #0.'; else: aidVariations = sorted(aidVariations); return (aidVariations, sError);
def getEffectiveDateParam(self, sParamName=None): """ Gets the effective date parameter. Returns a timestamp suitable for database and url parameters. Returns None if not found or empty. The first call with sParamName set to None will set the internal _tsNow value upon successfull return. """ sName = sParamName if sParamName is not None else WuiDispatcherBase.ksParamEffectiveDate if sName not in self._dParams: return None if sName not in self._asCheckedParams: self._asCheckedParams.append(sName) sValue = self._dParams[sName] if isinstance(sValue, list): raise WuiException( '%s parameter "%s" is given multiple times: %s' % (self._sAction, sName, sValue)) sValue = sValue.strip() if sValue == '': return None # # Timestamp, just validate it and return. # if sValue[0] not in ['-', '+']: (sValue, sError) = ModelDataBase.validateTs(sValue) if sError is not None: raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError)) if sParamName is None and self._tsNow is None: self._tsNow = sValue return sValue # # Relative timestamp. Validate and convert it to a fixed timestamp. # chSign = sValue[0] (sValue, sError) = ModelDataBase.validateTs(sValue[1:]) if sError is not None: raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError)) if sValue[-6] in ['-', '+']: raise WuiException( '%s parameter "%s" ("%s") is a relative timestamp but incorrectly includes a time zone.' % (self._sAction, sName, sValue)) offTime = 11 if sValue[offTime - 1] != ' ': raise WuiException('%s parameter "%s" ("%s") incorrect format.' % (self._sAction, sName, sValue)) sInterval = 'P' + sValue[:(offTime - 1)] + 'T' + sValue[offTime:] self._oDb.execute('SELECT CURRENT_TIMESTAMP ' + chSign + ' \'' + sInterval + '\'::INTERVAL') oDate = self._oDb.fetchOne()[0] sValue = str(oDate) if sParamName is None and self._tsNow is None: self._tsNow = sValue return sValue