def execute(self,State): """ install linux build """ self.init(State) if self.logflag == True: self.logger.log(self.info) # 1.connect to Linux machine self = Command.getClient(self) if self.stat == self.FAILED: return self.FAILED #2. get official build path copyToPath = Command.checkPath(self.buildLocation)+self.buildNo+"/"+self.buildVersion+"/BIN/" print "version:"+self.buildVersion print "copyto path:" +copyToPath targetPath = Command.checkPath(self.buildInstallPath)+self.buildNo+"/"+self.buildVersion+"/" #3. check if copytopath and installpath exist if Command.checkPathExist(copyToPath,self.client) == False: self.stat = self.FAILED self.info = "can not open build folder, the test build may not be ready" if self.logflag == True: self.logger.log(self.info) return self.FAILED if Command.checkPathExist(self.buildInstallPath,self.client) == False: self.stat = self.FAILED self.info = "can not open build folder, please provide the right install path" if self.logflag == True: self.logger.log(self.info) return self.FAILED #4. Check if there are enough disk self = Command.getUnixOS(self) buildsize = Command.getFolderSize(self.client,copyToPath+self.OS); diskspace = Command.getDiskSpace(self.client,self.buildInstallPath) if int(diskspace) < int(buildsize): self.stat = self.FAILED self.info = "there is not enough disk space to install build, please clean the disk space" if self.logflag == True: self.logger.log(self.info) return self.FAILED #2. install build. cmd = "perl "+copyToPath+"copyto.pl "+targetPath result = Command.executeSsh(cmd, self.client) if result.lower().find("command not found") != -1: self.stat = self.FAILED self.info = "target build not found, please check if the build ready is ready" if self.logflag == True: self.logger.log(self.info) return self.FAILED else: self.stat = self.PASS self.info ="build install success: "+targetPath if self.logflag == True: self.logger.log(self.info) return self.PASS
def checkCoreDiskSpace(self): """ check if there are enough diskspace of the build path, if core_pattern are default. """ coredumppath = Command.checkPath(self.coredumppath) #get coredump disk space diskspace = Command.getDiskSpace(self.client,coredumppath) #get system RSS mem = Command.executeSsh("free -m | awk \'NR==2{print $2}\'", self.client) if int(mem) > int(diskspace): self.stat = self.ABORT self.info = "not enough disk space for coredump" if self.logflag == True: self.logger.log(self.info) return self.ABORT else: return self.RUNNING