예제 #1
0
    def test_format_problems(self):
        '''
        Test default problem formatting
        '''

        pl = problem.list()
        res = format_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)
예제 #2
0
 def run(self, arguments):
     problems = match_get_problems(arguments.patterns,
                                   authenticate=arguments.authenticate,
                                   executables=arguments.executables,
                                   components=arguments.components,
                                   since=arguments.since,
                                   until=arguments.until,
                                   n_latest=arguments.n_latest,
                                   not_reported=arguments.not_reported)
     for problem in problems:
         if hasattr(problem, 'backtrace'):
             print(format_problems(problem, fmt=config.BACKTRACE_FMT))
         else:
             print(_('Problem has no backtrace'))
             if isinstance(problem, Ccpp):
                 if ask_yes_no(_('Start retracing process?')):
                     run_command('retrace', arguments)
                     print(
                         format_problems(problem, fmt=config.BACKTRACE_FMT))
예제 #3
0
    def test_format_problems_oneline(self):
        '''
        Test oneline problem formatting
        '''

        pl = problem.list()
        res = format_problems(pl, fmt=ONELINE_FMT)

        self.assertIn('bc60a5c 15x pavucontrol', res)
        self.assertIn('ffe635c 1x /home/user/bin/user_app', res)
예제 #4
0
    def test_format_problems_custom_oneline(self):
        '''
        Test custom problem formatting
        '''

        pl = problem.list()
        fmt = '''{short_id} {uid_username}'''
        res = format_problems(pl, fmt=fmt)

        self.assertIn('1234', res)
        self.assertTrue(len(res.splitlines()) == len(pl))
예제 #5
0
    def test_format_problems_custom(self):
        '''
        Test custom problem formatting
        '''

        pl = problem.list()
        fmt = '''#table|id,{short_id}|user id,{uid_username}| '''
        res = format_problems(pl, fmt=fmt)

        self.assertIn('User id', res)
        self.assertIn('1234', res)
        self.assertTrue(len(res.splitlines()) > len(pl))
예제 #6
0
파일: info.py 프로젝트: yazanmonshed/abrt
    def run(self, arguments):
        problems = match_get_problems(arguments.patterns,
                                      authenticate=arguments.authenticate,
                                      executables=arguments.executables,
                                      components=arguments.components,
                                      since=arguments.since,
                                      until=arguments.until,
                                      n_latest=arguments.n_latest,
                                      not_reported=arguments.not_reported)

        fmt = arguments.format
        if not fmt:
            fmt = getattr(config, '{}_FMT'.format(arguments.pretty.upper()))

        print(format_problems(problems, fmt=fmt))
예제 #7
0
파일: list.py 프로젝트: yazanmonshed/abrt
 def run(self, arguments):
     problems = match_lookup(['*'],
                             authenticate=arguments.authenticate,
                             executables=arguments.executables,
                             components=arguments.components,
                             since=arguments.since,
                             until=arguments.until,
                             n_latest=arguments.n_latest,
                             not_reported=arguments.not_reported)
     if problems:
         fmt = arguments.format
         if not fmt:
             fmt = getattr(config, '%s_FMT' % (arguments.pretty.upper()))
         print(format_problems(problems, fmt=fmt))
     else:
         print(_('No problems'))
예제 #8
0
    def run(self, arguments):
        # We don’t get these bad boys when invoked by the “backtrace” command.
        local = getattr(arguments, 'local', False)
        remote = getattr(arguments, 'remote', False)
        force = getattr(arguments, 'force', False)

        problems = match_get_problems(arguments.patterns,
                                      authenticate=arguments.authenticate,
                                      executables=arguments.executables,
                                      components=arguments.components,
                                      since=arguments.since,
                                      until=arguments.until,
                                      n_latest=arguments.n_latest,
                                      not_reported=arguments.not_reported)
        for problem in problems:
            if hasattr(problem, 'backtrace') and not force:
                print(_('Problem already has a backtrace'))
                print(_('Run abrt retrace with -f/--force to retrace again'))
                if ask_yes_no(_('Show backtrace?')):
                    print(format_problems(problem, fmt=config.BACKTRACE_FMT))
            elif not isinstance(problem, Ccpp):
                print(_('No retracing possible for this problem type'))
            else:
                if not (local or remote):
                    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

                problem.chown()

                if remote:
                    print(_('Remote retracing'))
                    run_event('analyze_RetraceServer', problem)
                else:
                    print(_('Local retracing'))
                    run_event('analyze_LocalGDB', problem)
예제 #9
0
파일: remove.py 프로젝트: yazanmonshed/abrt
    def run(self, arguments):
        problems = match_get_problems(arguments.patterns,
                                      authenticate=arguments.authenticate,
                                      executables=arguments.executables,
                                      components=arguments.components,
                                      since=arguments.since,
                                      until=arguments.until,
                                      n_latest=arguments.n_latest,
                                      not_reported=arguments.not_reported)
        for problem in problems:
            print(format_problems(problem, fmt=config.FULL_FMT), '\n')

            if not arguments.force:
                if not ask_yes_no(
                        _('Are you sure you want to delete this problem?')):
                    continue

            problem.delete()
            print(_('Removed'), '\n')
예제 #10
0
    def test_format_problems_empty_input(self):
        '''
        Test that format_problems handles None as problem list
        '''

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