예제 #1
0
def validate_ureport1(ureport):
    """
    Validates uReport1
    """

    ureport2 = ureport1to2(ureport)
    validate_ureport2(ureport2)
예제 #2
0
파일: ureport.py 프로젝트: patriczek/faf
def validate_ureport1(ureport):
    """
    Validates uReport1
    """

    ureport2 = ureport1to2(ureport)
    validate_ureport2(ureport2)
예제 #3
0
def validate_ureport1(ureport) -> None:
    """
    Validates uReport1
    """

    ureport_2 = ureport1to2(ureport)
    validate_ureport2(ureport_2)
예제 #4
0
파일: ureport.py 프로젝트: patriczek/faf
def save_ureport1(db, ureport, create_component=False, timestamp=None, count=1):
    """
    Saves uReport1
    """

    ureport2 = ureport1to2(ureport)
    validate(ureport2)
    save_ureport2(db, ureport2, create_component=create_component,
                  timestamp=timestamp, count=count)
예제 #5
0
def save_ureport1(db, ureport, create_component=False, timestamp=None, count=1):
    """
    Saves uReport1
    """

    ureport2 = ureport1to2(ureport)
    validate(ureport2)
    save_ureport2(db, ureport2, create_component=create_component,
                  timestamp=timestamp, count=count)
예제 #6
0
def ureport2(ureport):
    """
    Takes `ureport` and converts it to uReport2 if necessary.
    """

    ver = get_version(ureport)

    if ver == 1:
        return ureport1to2(ureport)
    elif ver == 2:
        return ureport

    raise FafError("uReport version {0} is not supported".format(ver))
예제 #7
0
파일: ureport.py 프로젝트: patriczek/faf
def ureport2(ureport):
    """
    Takes `ureport` and converts it to uReport2 if necessary.
    """

    ver = get_version(ureport)

    if ver == 1:
        return ureport1to2(ureport)
    elif ver == 2:
        return ureport

    raise FafError("uReport version {0} is not supported".format(ver))
예제 #8
0
    def find_solution_ureport(self,
                              db,
                              ureport,
                              osr=None) -> Optional[SfPrefilterSolution]:
        """
        Check whether uReport matches a knowledgebase
        entry. Return a pyfaf.storage.SfPrefilterSolution object or None.
        """

        if "ureport_version" in ureport and ureport["ureport_version"] == 1:
            ureport = ureport1to2(ureport)
            validate(ureport)

        db_opsys = None
        if osr is not None:
            db_opsys = osr.opsys

        osname = ureport["os"]["name"]
        if osname not in systems:
            log.warning("Operating system '%s' is not supported", osname)
        else:
            osplugin = systems[osname]
            db_opsys = get_opsys_by_name(db, osplugin.nice_name)
            if db_opsys is None:
                log.warning(
                    "Operaring system '%s' is not installed in storage",
                    osplugin.nice_name)
            else:
                pkgname_parsers = self._get_pkgname_parsers(db,
                                                            db_opsys=db_opsys)
                for parser, solution in pkgname_parsers.items():
                    if osplugin.check_pkgname_match(ureport["packages"],
                                                    parser):
                        return self._sfps_to_solution(solution)

        ptype = ureport["problem"]["type"]
        if ptype not in problemtypes:
            log.warning("Problem type '%s' is not supported", ptype)
        else:
            problemplugin = problemtypes[ptype]
            btpath_parsers = self._get_btpath_parsers(db, db_opsys=db_opsys)
            for parser, solution in btpath_parsers.items():
                if problemplugin.check_btpath_match(ureport["problem"],
                                                    parser):
                    return self._sfps_to_solution(solution)

        return None
예제 #9
0
    def find_solution_ureport(self, db, ureport, osr=None):
        """
        Check whether uReport matches a knowledgebase
        entry. Return a pyfaf.storage.SfPrefilterSolution object or None.
        """

        if "ureport_version" in ureport and ureport["ureport_version"] == 1:
            ureport = ureport1to2(ureport)
            validate(ureport)

        db_opsys = None
        if osr is not None:
            db_opsys = osr.opsys

        osname = ureport["os"]["name"]
        if osname not in systems:
            log.warning("Operating system '%s' is not supported", osname)
        else:
            osplugin = systems[osname]
            db_opsys = get_opsys_by_name(db, osplugin.nice_name)
            if db_opsys is None:
                log.warning("Operaring system '%s' is not installed in storage",
                            osplugin.nice_name)
            else:
                pkgname_parsers = self._get_pkgname_parsers(db, db_opsys=db_opsys)
                for parser, solution in pkgname_parsers.items():
                    if osplugin.check_pkgname_match(ureport["packages"], parser):
                        return self._sfps_to_solution(solution)

        ptype = ureport["problem"]["type"]
        if ptype not in problemtypes:
            log.warning("Problem type '%s' is not supported", ptype)
        else:
            problemplugin = problemtypes[ptype]
            btpath_parsers = self._get_btpath_parsers(db, db_opsys=db_opsys)
            for parser, solution in btpath_parsers.items():
                if problemplugin.check_btpath_match(ureport["problem"], parser):
                    return self._sfps_to_solution(solution)

        return None