Exemplo n.º 1
0
    def test_load_plugins(self):
        """
        Test if load_plugins returns correct results
        """

        plugins = load_plugins(Base)
        self.assertIn('sub-plugin', plugins)
        self.assertIs(isinstance(plugins['sub-plugin'], Sub), True)
        self.assertIs(isinstance(plugins['sub-plugin'], Base), True)
Exemplo n.º 2
0
    def test_load_plugins(self):
        """
        Test if load_plugins returns correct results
        """

        plugins = load_plugins(Base)
        self.assertIn('sub-plugin', plugins)
        self.assertIs(isinstance(plugins['sub-plugin'], Sub), True)
        self.assertIs(isinstance(plugins['sub-plugin'], Base), True)
Exemplo n.º 3
0
    def get_opsys_name(self, cmdline_opsys):
        """
        Get correct opsys name from user passed opsys
        or raise FafError if not available
        """

        cmdline_opsys = cmdline_opsys.lower()
        if not cmdline_opsys in systems:
            raise FafError(
                "Operating system '{0}' does not exist".format(cmdline_opsys))

        return systems[cmdline_opsys].nice_name

    def get_db_opsys(self, db, cmdline_opsys):
        """
        Get opsys object from database or raise
        FafError if not available
        """

        opsys_name = self.get_opsys_name(cmdline_opsys)
        db_opsys = get_opsys_by_name(db, opsys_name)
        if db_opsys is None:
            raise FafError(
                "Operating system '{0}' is not installed".format(opsys_name))

        return db_opsys


import_dir(__name__, os.path.dirname(__file__))
load_plugins(Action, actions)
Exemplo n.º 4
0
                                  .format(self.__class__.__name__))

    def compare_many(self, db_reports):
        """
        Some libraries (btparser, satyr) provide a way to compare
        many reports at the same time returning a report list
        and distances object. This may be a significant speedup.
        """

        raise NotImplementedError("compare_many is not implemented for {0}"
                                  .format(self.__class__.__name__))

    def check_btpath_match(self, ureport, parser):
        """
        Check whether a path in stacktrace matches to a knowledgebase rule.
        """

        raise NotImplementedError("check_btpath_match is not implemented for "
                                  "{0}".format(self.__class__.__name__))

    def find_crash_function(self, db_backtrace):
        """
        Find the crash function of a backtrace.
        """

        raise NotImplementedError("find_crash_function is not implemented for "
                                  "{0}".format(self.__class__.__name__))

import_dir(__name__, os.path.dirname(__file__))
load_plugins(ProblemType, problemtypes)
Exemplo n.º 5
0
    def find_solutions_problem(self, db, problem, osr=None):
        solutions = []
        for report in problem.reports:
            solution = self.find_solution_db_report(db, report, osr)
            if solution:
                if isinstance(solution, list):
                    this_solutions = solution
                else:
                    this_solutions = [solution, ]
                for solution in this_solutions:
                    if solution not in solutions:
                        solutions.append(solution)
        return solutions

import_dir(__name__, os.path.dirname(__file__))
load_plugins(SolutionFinder, solution_finders)


def find_solution(report, db=None, finders=None, osr=None):
    """
    Check whether a Solution exists for a report (pyfaf.storage.Report or
    uReport dict). Return pyfaf.storage.SfPrefilterSolution object for the
    solution with the highest priority (i.e. lowest number) or None.
    """

    solutions = find_solutions_report(report, db, finders, osr)

    if solutions and len(solutions) > 0:
        return solutions[0]
    else:
        return None
Exemplo n.º 6
0
    def get_opsys_name(self, cmdline_opsys):
        """
        Get correct opsys name from user passed opsys
        or raise FafError if not available
        """

        cmdline_opsys = cmdline_opsys.lower()
        if not cmdline_opsys in systems:
            raise FafError("Operating system '{0}' does not exist"
                           .format(cmdline_opsys))

        return systems[cmdline_opsys].nice_name

    def get_db_opsys(self, db, cmdline_opsys):
        """
        Get opsys object from database or raise
        FafError if not available
        """

        opsys_name = self.get_opsys_name(cmdline_opsys)
        db_opsys = get_opsys_by_name(db, opsys_name)
        if db_opsys is None:
            raise FafError("Operating system '{0}' is not installed"
                           .format(opsys_name))

        return db_opsys

import_dir(__name__, os.path.dirname(__file__))
load_plugins(Action, actions)
Exemplo n.º 7
0
    def find_solutions_problem(self, db, problem, osr=None):
        solutions = []
        for report in problem.reports:
            solution = self.find_solution_db_report(db, report, osr)
            if solution:
                if isinstance(solution, list):
                    this_solutions = solution
                else:
                    this_solutions = [solution, ]
                for solution in this_solutions:
                    if solution not in solutions:
                        solutions.append(solution)
        return solutions

import_dir(__name__, os.path.dirname(__file__))
load_plugins(SolutionFinder, solution_finders)


def find_solution(report, db=None, finders=None, osr=None):
    """
    Check whether a Solution exists for a report (pyfaf.storage.Report or
    uReport dict). Return pyfaf.storage.SfPrefilterSolution object for the
    solution with the highest priority (i.e. lowest number) or None.
    """

    solutions = find_solutions_report(report, db, finders, osr)

    if solutions:
        return solutions[0]

    return None
Exemplo n.º 8
0
        """
        Compare 2 pyfaf.storage.Report objects returning an integer
        in range [-100; 100]
        -100: reports are totally different, report1 > report2
        0: reports are equal
        100: reports are totally different, report2 > report1
        """

        raise NotImplementedError("compare is not implemented for {0}".format(
            self.__class__.__name__))

    def check_btpath_match(self, ureport, parser) -> None:
        """
        Check whether a path in stacktrace matches to a knowledgebase rule.
        """

        raise NotImplementedError("check_btpath_match is not implemented for "
                                  "{0}".format(self.__class__.__name__))

    def find_crash_function(self, db_backtrace) -> None:
        """
        Find the crash function of a backtrace.
        """

        raise NotImplementedError("find_crash_function is not implemented for "
                                  "{0}".format(self.__class__.__name__))


import_dir(__name__, os.path.dirname(__file__))
load_plugins(ProblemType, problemtypes)
Exemplo n.º 9
0
        """

        raise NotImplementedError("download_bug_to_storage is not implemented "
                                  "for {0}".format(self.__class__.__name__))

    def create_bug(self, **data):
        """
        Creates a new bug with given data.
        """

        raise NotImplementedError("create_bug is not implemented for "
                                  "{0}".format(self.__class__.__name__))

    def clone_bug(self, orig_bug_id, new_product, new_version):
        """
        Clones the bug - Creates the same bug reported against a different
        product and version.
        """

        raise NotImplementedError("clone_bug is not implemented for {0}"
                                  .format(self.__class__.__name__))


import_dir(__name__, os.path.dirname(__file__))
load_plugins(BugTracker, bugtrackers)

report_backref_names = set() #pylint: disable=invalid-name
for bt in bugtrackers.values():
    if bt.report_backref_name is not None:
        report_backref_names.add(bt.report_backref_name)
Exemplo n.º 10
0
        `attachment` may be string or file-like object.
        """

        raise NotImplementedError("add_attachment is not implemented for " "{0}".format(self.__class__.__name__))

    def attach_bug_to_db_report(self, db, db_report, bug_id):
        """
        Attaches bug with given bug ID to a given `db_report`.
        """

        raise NotImplementedError(
            "attach_bug_to_db_report is not implemented " "for {0}".format(self.__class__.__name__)
        )

    def clone_bug(self, bug_id, new_product, new_version):
        """
        Clones the bug - Creates the same bug reported against a different
        product and version.
        """

        raise NotImplementedError("clone_bug is not implemented for {0}".format(self.__class__.__name__))


import_dir(__name__, os.path.dirname(__file__))
load_plugins(BugTracker, bugtrackers)

report_backref_names = set()
for bt in bugtrackers.values():
    if bt.report_backref_name is not None:
        report_backref_names.add(bt.report_backref_name)
Exemplo n.º 11
0
                                  "{0}".format(self.__class__.__name__))

    def get_build_candidates(self, db) -> None:
        """
        Query the builds that may be mapped into components.
        """

        raise NotImplementedError(
            "get_build_candidates is not implemented for "
            "{0}".format(self.__class__.__name__))

    def check_pkgname_match(self, packages, parser) -> None:
        """
        Check whether a relevant package matches to a knowledgebase rule.
        """

        raise NotImplementedError("check_pkgname_match is not implemented for "
                                  "{0}".format(self.__class__.__name__))

    def get_released_builds(self, release) -> None:
        """
        Get a list of builds for the given release.
        """

        raise NotImplementedError("get_released_builds is not implemented for "
                                  "{0}".format(self.__class__.__name__))


import_dir(__name__, os.path.dirname(__file__))
load_plugins(System, systems)
Exemplo n.º 12
0
        { "release1": self.get_component_acls(component, release="release1"),
          "release2": self.get_component_acls(component, release="release2") }
        """

        raise NotImplementedError("get_component_acls is not implemented for " "{0}".format(self.__class__.__name__))

    def get_build_candidates(self, db):
        """
        Query the builds that may be mapped into components.
        """

        raise NotImplementedError("get_build_candidates is not implemented for " "{0}".format(self.__class__.__name__))

    def check_pkgname_match(self, packages, parser):
        """
        Check whether a relevant package matches to a knowledgebase rule.
        """

        raise NotImplementedError("check_pkgname_match is not implemented for " "{0}".format(self.__class__.__name__))

    def get_released_builds(self, release):
        """
        Get a list of builds for the given release.
        """

        raise NotImplementedError("get_released_builds is not implemented for " "{0}".format(self.__class__.__name__))


import_dir(__name__, os.path.dirname(__file__))
load_plugins(System, systems)