def _doUpgrade(self, oResponse, oConnection, fReboot): """ Common worker for _cmdUpgrade and _cmdUpgradeAndReboot. Will sys.exit on success! """ # # The server specifies a ZIP archive with the new scripts. It's ASSUMED # that the zip is of selected files at g_ksValidationKitDir in SVN. It's # further ASSUMED that we're executing from # sZipUrl = oResponse.getStringChecked( constants.tbresp.UPGRADE_PARAM_URL) oResponse.checkParameterCount(2) if utils.isRunningFromCheckout(): raise TestBoxException( 'Cannot upgrade when running from the tree!') oConnection.sendAckAndClose(constants.tbresp.CMD_UPGRADE_AND_REBOOT if fReboot else constants.tbresp.CMD_UPGRADE) testboxcommons.log('Upgrading...') # # Download the file and install it. # sDstFile = os.path.join(g_ksTestScriptDir, 'VBoxTestBoxScript.zip') if os.path.exists(sDstFile): os.unlink(sDstFile) fRc = webutils.downloadFile(sZipUrl, sDstFile, self._oTestBoxScript.getPathBuilds(), testboxcommons.log) if fRc is not True: return False if upgradeFromZip(sDstFile) is not True: return False # # Restart the system or the script (we have a parent script which # respawns us when we quit). # if fReboot: self.doReboot() sys.exit(TBS_EXITCODE_NEED_UPGRADE) return False
def _doUpgrade(self, oResponse, oConnection, fReboot): """ Common worker for _cmdUpgrade and _cmdUpgradeAndReboot. Will sys.exit on success! """ # # The server specifies a ZIP archive with the new scripts. It's ASSUMED # that the zip is of selected files at g_ksValidationKitDir in SVN. It's # further ASSUMED that we're executing from # sZipUrl = oResponse.getStringChecked(constants.tbresp.UPGRADE_PARAM_URL) oResponse.checkParameterCount(2); if utils.isRunningFromCheckout(): raise TestBoxException('Cannot upgrade when running from the tree!'); oConnection.sendAckAndClose(constants.tbresp.CMD_UPGRADE_AND_REBOOT if fReboot else constants.tbresp.CMD_UPGRADE); testboxcommons.log('Upgrading...'); # # Download the file and install it. # sDstFile = os.path.join(g_ksTestScriptDir, 'VBoxTestBoxScript.zip'); if os.path.exists(sDstFile): os.unlink(sDstFile); fRc = webutils.downloadFile(sZipUrl, sDstFile, self._oTestBoxScript.getPathBuilds(), testboxcommons.log); if fRc is not True: return False; if upgradeFromZip(sDstFile) is not True: return False; # # Restart the system or the script (we have a parent script which # respawns us when we quit). # if fReboot: self.doReboot(); sys.exit(TBS_EXITCODE_NEED_UPGRADE); return False; # shuts up pylint (it will probably complain later when it learns DECL_NO_RETURN).