def check_adi_project(self, project): query_project = 'adi:' + project.split(':adi:')[1] query = {'format': 'json'} url = self.api.makeurl( ('project', 'staging_projects', self.api.project, query_project), query=query) info = json.load(self.api.retried_GET(url)) if len(info['building_repositories']): print project, "still building" return if len(info['broken_packages']): print "https://build.opensuse.org/project/show/{}".format( project), "has broken packages" return for review in info['missing_reviews']: print project, "has at least one missing review by", review[ 'by'], "in", review['request'] return if len(info['untracked_requests']) or len(info['obsolete_requests']): print project, "has inconsistent requests" return print project, "is ready" for req in info['selected_requests']: print req['id'] self.api.rm_from_prj(project, request_id=req['id'], msg='ready to accept') delete_project(self.api.apiurl, project)
def handle_wi(self, wid): """Actual job thread.""" wid.result = False if not wid.fields.build_trial or not wid.fields.build_trial.project : raise RuntimeError("Missing mandatory field 'build_trial.project'") obs = BuildService(oscrc=self.oscrc, apiurl=wid.fields.ev.namespace) try: wid.result = False core.delete_project(obs.apiurl, wid.fields.build_trial.project, force=True, msg="Removed by BOSS") self.log.info("Trial area %s removed" % wid.fields.build_trial.project) del(wid.fields.build_trial.as_dict()["project"]) wid.result = True except HTTPError as err: if err.code == 403: self.log.info("Is the BOSS user (see /etc/skynet/oscrc) enabled as a"\ " maintainer in %s or its parent?" \ % wid.fields.build_trial.project) if err.code == 404: self.log.info("HTTPError 404 : The project is already gone") wid.result = True return raise err
def handle_wi(self, wid): """Actual job thread.""" wid.result = False if not wid.fields.build_trial or not wid.fields.build_trial.project: raise RuntimeError("Missing mandatory field 'build_trial.project'") obs = BuildService(oscrc=self.oscrc, apiurl=wid.fields.ev.namespace) try: wid.result = False core.delete_project(obs.apiurl, wid.fields.build_trial.project, force=True, msg="Removed by BOSS") self.log.info("Trial area %s removed" % wid.fields.build_trial.project) del (wid.fields.build_trial.as_dict()["project"]) wid.result = True except HTTPError as err: if err.code == 403: self.log.info("Is the BOSS user (see /etc/skynet/oscrc) enabled as a"\ " maintainer in %s or its parent?" \ % wid.fields.build_trial.project) if err.code == 404: self.log.info("HTTPError 404 : The project is already gone") wid.result = True return raise err
def check_adi_project(self, project): query_project = self.api.extract_staging_short(project) info = self.api.project_status(project, True) if len(info['selected_requests']): if len(info['building_repositories']): print query_project, Fore.MAGENTA + 'building' return if len(info['untracked_requests']): print query_project, Fore.YELLOW + 'untracked:', ', '.join([ '{}[{}]'.format(Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['untracked_requests'] ]) return if len(info['obsolete_requests']): print query_project, Fore.YELLOW + 'obsolete:', ', '.join([ '{}[{}]'.format(Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['obsolete_requests'] ]) return if len(info['broken_packages']): print query_project, Fore.RED + 'broken:', ', '.join([ Fore.CYAN + p['package'] + Fore.RESET for p in info['broken_packages'] ]) return for review in info['missing_reviews']: print query_project, Fore.WHITE + 'review:', '{} for {}[{}]'.format( Fore.YELLOW + review['by'] + Fore.RESET, Fore.CYAN + review['package'] + Fore.RESET, review['request']) return if self.api.is_user_member_of(self.api.user, self.api.cstaging_group): print query_project, Fore.GREEN + 'ready' packages = [] for req in info['selected_requests']: print ' - {} [{}]'.format( Fore.CYAN + req['package'] + Fore.RESET, req['number']) self.api.rm_from_prj(project, request_id=req['number'], msg='ready to accept') packages.append(req['package']) self.api.accept_status_comment(project, packages) try: delete_project(self.api.apiurl, project, force=True) except urllib2.HTTPError as e: print(e) pass else: print query_project, Fore.GREEN + 'ready:', ', '.join([ '{}[{}]'.format(Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['selected_requests'] ])
def deleteProject(self, project): """ deleteProject(project) Delete the specific project """ try: core.delete_project(self.apiurl, project) except Exception: return False return True
def check_adi_project(self, project): query_project = self.api.extract_staging_short(project) info = self.api.project_status(project, True) if len(info['selected_requests']): if len(info['building_repositories']): print(query_project + ' ' + Fore.MAGENTA + 'building') return if len(info['untracked_requests']): print(query_project + ' ' + Fore.YELLOW + 'untracked: ' + ', '.join(['{}[{}]'.format( Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['untracked_requests']])) return if len(info['obsolete_requests']): print(query_project + ' ' + Fore.YELLOW + 'obsolete: ' + ', '.join(['{}[{}]'.format( Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['obsolete_requests']])) return if len(info['broken_packages']): print(query_project + ' ' + Fore.RED + 'broken: ' + ', '.join([ Fore.CYAN + p['package'] + Fore.RESET for p in info['broken_packages']])) return for review in info['missing_reviews']: print(query_project + ' ' + Fore.WHITE + 'review: ' + '{} for {}[{}]'.format( Fore.YELLOW + review['by'] + Fore.RESET, Fore.CYAN + review['package'] + Fore.RESET, review['request'])) return for check in info['missing_checks']: print(query_project + ' ' + Fore.MAGENTA + 'missing: {}'.format(check)) return for check in info['checks']: if check['state'] != 'success': print(query_project + '{} {} check: {}'.format(Fore.MAGENTA, check['state'], check['name'])) return if self.api.is_user_member_of(self.api.user, self.api.cstaging_group): print(query_project + ' ' + Fore.GREEN + 'ready') packages = [] for req in info['selected_requests']: print(' - {} [{}]'.format(Fore.CYAN + req['package'] + Fore.RESET, req['number'])) self.api.rm_from_prj(project, request_id=req['number'], msg='ready to accept') packages.append(req['package']) self.api.accept_status_comment(project, packages) try: delete_project(self.api.apiurl, project, force=True) except HTTPError as e: print(e) pass else: print(query_project, Fore.GREEN + 'ready:', ', '.join(['{}[{}]'.format( Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['selected_requests']]))
def _delete_project(self, prj): try: core.delete_project(self.obs.apiurl, prj, force=True, msg="Removed by BOSS") self.log.info("Trial area %s removed" % prj) except HTTPError as err: if err.code == 403: self.log.info("Is the BOSS user (see /etc/skynet/oscrc) enabled as a"\ " maintainer in %s or its parent?" \ % prj) elif err.code == 404: self.log.info("HTTPError 404 : %s is already gone" % prj) else: raise err
def check_adi_project(self, project): query_project = self.api.extract_staging_short(project) info = self.api.project_status(project, True) if len(info['building_repositories']): print query_project, "still building" return if len(info['untracked_requests']): print query_project, "untracked:", ', '.join([ '%s[%s]' % (req['package'], req['number']) for req in info['untracked_requests'] ]) return if len(info['obsolete_requests']): print query_project, "obsolete:", ', '.join([ '%s[%s]' % (req['package'], req['number']) for req in info['obsolete_requests'] ]) return if len(info['broken_packages']): print query_project, "broken:", ', '.join( [p['package'] for p in info['broken_packages']]) return for review in info['missing_reviews']: print query_project, "missing review by {} for {}[{}]".format( review['by'], review['package'], review['request']) return if self.api.is_user_member_of(self.api.user, 'factory-staging'): print query_project, "is ready" packages = [] for req in info['selected_requests']: print " - %s [%s]" % (req['package'], req['number']) self.api.rm_from_prj(project, request_id=req['number'], msg='ready to accept') packages.append(req['package']) self.api.accept_status_comment(project, packages) delete_project(self.api.apiurl, project) else: print query_project, "ready:", ', '.join([ '%s[%s]' % (req['package'], req['number']) for req in info['selected_requests'] ])
def check_adi_project(self, project): query_project = 'adi:' + project.split(':adi:')[1] query = {'format': 'json'} url = self.api.makeurl(('project', 'staging_projects', self.api.project, query_project), query=query) info = json.load(self.api.retried_GET(url)) if len(info['building_repositories']): print project, "still building" return if len(info['broken_packages']): print "https://build.opensuse.org/project/show/{}".format(project), "has broken packages" return for review in info['missing_reviews']: print project, "has at least one missing review by", review['by'], "in", review['request'] return if len(info['untracked_requests']) or len(info['obsolete_requests']): print project, "has inconsistent requests" return print project, "is ready" for req in info['selected_requests']: print req['id'] self.api.rm_from_prj(project, request_id=req['id'], msg='ready to accept') delete_project(self.api.apiurl, project)