Example #1
0
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))
Example #2
0
    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)
Example #3
0
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'))
Example #4
0
    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)
Example #5
0
File: cli.py Project: jfilak/abrt
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))
Example #6
0
File: cli.py Project: xsuchy/abrt
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))
Example #7
0
    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)
Example #8
0
    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)
Example #9
0
    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))
Example #10
0
    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))
Example #11
0
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'))
Example #12
0
    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))
Example #13
0
    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))
Example #14
0
File: cli.py Project: jfilak/abrt
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)
Example #15
0
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)
Example #16
0
    def test_fmt_problems_empty_input(self):
        '''
        Test that fmt_problems handles None as problem list
        '''

        self.assertEqual(fmt_problems(None), '')
Example #17
0
    def test_fmt_problems_empty_input(self):
        '''
        Test that fmt_problems handles None as problem list
        '''

        self.assertEqual(fmt_problems(None), '')