def backtrace(args): prob = match_get_problem(args.MATCH, auth=args.auth) if hasattr(prob, 'backtrace'): print(fmt_problems(prob, fmt=config.BACKTRACE_FMT)) else: print(_('Problem has no backtrace')) if isinstance(prob, problem.Ccpp): ret = ask_yes_no(_('Start retracing process?')) if ret: retrace(args) print(fmt_problems(prob, fmt=config.BACKTRACE_FMT))
def test_fmt_problems(self): ''' Test default problem formatting ''' pl = problem.list() res = fmt_problems(pl) for prob in pl: self.assertIn(prob.short_id, res) field, value = get_human_identifier(prob) self.assertIn(value, res) self.assertIn(str(prob.count), res) self.assertIn('Bugzilla', res) self.assertIn('https://bugzilla.redhat.com/show_bug.cgi?id=1223349', res) self.assertIn('ABRT Server', res) furl = 'https://retrace.fedoraproject.org/faf/reports/bthash/' \ '3505a6db8a6bd51a3d690f1553b' self.assertIn(furl, res) self.assertIn('Not reportable', res) self.assertIn('Not reportable reason', res)
def list_problems(args): probs = sort_problems(problem.list(auth=args.auth)) if args.since: probs = filter_since_timestamp(probs, args.since) if args.until: probs = filter_until_timestamp(probs, args.until) if args.not_reported: probs = filter_not_reported(probs) if not args.fmt: fmt = config.MEDIUM_FMT else: fmt = args.fmt if args.pretty != 'medium': fmt = getattr(config, '{}_FMT'.format(args.pretty.upper())) out = fmt_problems(probs, fmt=fmt) if out: print(out) else: print(_('No problems'))
def info(args): prob = match_get_problem(args.MATCH, allow_multiple=True, auth=args.auth) if not args.fmt: fmt = config.FULL_FMT if args.pretty != "full": fmt = getattr(config, "{}_FMT".format(args.pretty.upper())) print(fmt_problems(prob, fmt=fmt))
def info(args): prob = match_get_problem(args.MATCH, allow_multiple=True, auth=args.auth) if not args.fmt: fmt = config.FULL_FMT if args.pretty != 'full': fmt = getattr(config, '{}_FMT'.format(args.pretty.upper())) print(fmt_problems(prob, fmt=fmt))
def test_fmt_problems_oneline(self): ''' Test oneline problem formatting ''' pl = problem.list() res = fmt_problems(pl, fmt=ONELINE_FMT) self.assertIn('bc60a5c 15x pavucontrol', res) self.assertIn('ffe635c 1x /home/user/bin/user_app', res)
def test_fmt_problems_custom_oneline(self): ''' Test custom problem formatting ''' pl = problem.list() fmt = '''{short_id} {uid_username}''' res = fmt_problems(pl, fmt=fmt) self.assertIn('1234', res) self.assertTrue(len(res.splitlines()) == len(pl))
def remove(args): prob = match_get_problem(args.MATCH, auth=args.auth) print(fmt_problems(prob, fmt=config.FULL_FMT)) ret = True if not args.f and (args.i or args.MATCH == 'last'): # force prompt for last problem to avoid accidents ret = ask_yes_no(_('Are you sure you want to delete this problem?')) if ret: prob.delete() print(_('Removed'))
def test_fmt_problems_custom(self): ''' Test custom problem formatting ''' pl = problem.list() fmt = '''#table|id,{short_id}|user id,{uid_username}| ''' res = fmt_problems(pl, fmt=fmt) self.assertIn('User id', res) self.assertIn('1234', res) self.assertTrue(len(res.splitlines()) > len(pl))
def retrace(args): # we might not get these var if called from backtrace local, remote, auth = False, False, False if hasattr(args, "local"): local = args.local if hasattr(args, "remote"): remote = args.remote if hasattr(args, "force"): force = args.force prob = match_get_problem(args.MATCH, auth=args.auth) if hasattr(prob, "backtrace") and not force: print(_("Problem already has a backtrace")) print(_("Run abrt retrace with -f/--force to retrace again")) ret = ask_yes_no(_("Show backtrace?")) if ret: print(fmt_problems(prob, fmt=config.BACKTRACE_FMT)) elif not isinstance(prob, problem.Ccpp): print(_("No retracing possible for this problem type")) else: if not (local or remote): # ask.. ret = ask_yes_no( _( "Upload core dump and perform remote" " retracing? (It may contain sensitive data)." " If your answer is 'No', a stack trace will" " be generated locally. Local retracing" " requires downloading potentially large amount" " of debuginfo data" ) ) if ret: remote = True else: local = True prob.chown() if remote: print(_("Remote retracing")) run_event("analyze_RetraceServer", prob) else: print(_("Local retracing")) run_event("analyze_LocalGDB", prob)
def retrace(args): # we might not get these var if called from backtrace local, remote, auth = False, False, False if hasattr(args, 'local'): local = args.local if hasattr(args, 'remote'): remote = args.remote if hasattr(args, 'force'): force = args.force prob = match_get_problem(args.MATCH, auth=args.auth) if hasattr(prob, 'backtrace') and not force: print(_('Problem already has a backtrace')) print(_('Run abrt retrace with -f/--force to retrace again')) ret = ask_yes_no(_('Show backtrace?')) if ret: print(fmt_problems(prob, fmt=config.BACKTRACE_FMT)) elif not isinstance(prob, problem.Ccpp): print(_('No retracing possible for this problem type')) else: if not (local or remote): # ask.. ret = ask_yes_no( _('Upload core dump and perform remote' ' retracing? (It may contain sensitive data).' ' If your answer is \'No\', a stack trace will' ' be generated locally. Local retracing' ' requires downloading potentially large amount' ' of debuginfo data')) if ret: remote = True else: local = True prob.chown() if remote: print(_('Remote retracing')) run_event('analyze_RetraceServer', prob) else: print(_('Local retracing')) run_event('analyze_LocalGDB', prob)
def test_fmt_problems_empty_input(self): ''' Test that fmt_problems handles None as problem list ''' self.assertEqual(fmt_problems(None), '')