def _checkRpmInfo(self, package_name): package_info = utils.getPackageInfoByName(package_name) if package_info is None: io.error('setbranch', utils.PACKAGE_NAME_FORMAT) return False else: return True
def run(self, options, args): if not self._checkArgs(args): return error.ERROR_NO_SUCH_PACKAGE_NAME package_name = args[0] io.log('upload', 'checking %s ...' % package_name) if not self._checkRpmFileAccess(package_name): return error.ERROR_ACCESS_PACKAGE_ERROR if not self._checkRpmInfo(package_name): return error.ERROR_INVALID_PACKAGE is_login_succeed, client = self.login(options) if not is_login_succeed: return error.ERROR_AUTH_FAILED io.log('upload', 'start upload %s ...' % package_name) package_info = utils.getPackageInfoByName(package_name) pdu = self._getUploadPdu(package_info, package_name) if not client.invokeRemote(pdu): return error.ERROR_PDU_ERROR if not self._uploadPackage(client, package_name): return error.ERROR_PDU_ERROR return True
def _checkRpmInfo(self, package_name): package_info = utils.getPackageInfoByName(package_name) if package_info is None: io.error('upload', 'package name is not a valid format. format: <package_name>-<package_version>-<release>.el<os_version>.<arch>.rpm') return False package_name_from_file = utils.getPackageNameFromFile(package_name) if package_name_from_file is None: io.error('upload', 'not a rpm file') return False if not utils.isPackageAccord(package_name_from_file, package_infos=package_info): io.error('upload', 'rpm filename disaccord with real package name') return False return True
def run(self, options, args): if not self._checkArgs(args): return error.ERROR_INVALID_PARAM_COUNT io.debug("remove", "checking arguments...") package_name = args[0] branch = args[1] if not self._checkRpmInfo(package_name): return error.ERROR_NO_SUCH_PACKAGE_NAME if not self._checkBranch(branch): return error.ERROR_INVALID_BRANCH is_login_succeed, client = self.login(options) if not is_login_succeed: return error.ERROR_AUTH_FAILED package_info = utils.getPackageInfoByName(package_name) pdu = self._getRemovePdu(package_info, branch) if not client.invokeRemote(pdu): return error.ERROR_PDU_ERROR return error.ERROR_SUCCEED