Esempio n. 1
0
    def opsyscomponents(self):
        self.begin('Components')
        opsysobjs = self.ses.query(OpSys).all()

        for comp in data.COMPS:
            for obj in opsysobjs:
                if randutils.tosslow():
                    continue
                compobj = OpSysComponent(name=comp)
                compobj.opsys = obj
                for release in randutils.pickmost(obj.releases):
                    release_assoc = OpSysReleaseComponent()
                    release_assoc.release = release
                    compobj.opsysreleases.append(release_assoc)
                self.add(compobj)
        self.commit()
Esempio n. 2
0
    def opsyscomponents(self):
        self.begin('Components')
        opsysobjs = self.ses.query(OpSys).all()

        for comp in data.COMPS.keys():
            for obj in opsysobjs:
                if randutils.tosslow():
                    continue
                compobj = OpSysComponent(name=comp)
                compobj.opsys = obj
                for release in randutils.pickmost(obj.releases):
                    release_assoc = OpSysReleaseComponent()
                    release_assoc.release = release
                    compobj.opsysreleases.append(release_assoc)
                self.add(compobj)
        self.commit()
Esempio n. 3
0
    def opsyscomponents(self) -> None:
        self.begin('Components')
        opsysobjs = self.ses.query(OpSys).all()

        for comp in data.COMPS:
            for obj in opsysobjs:
                if randutils.tosslow():
                    continue
                compobj = OpSysComponent(name=comp)
                compobj.opsys = obj
                for release in randutils.pickmost(obj.releases):
                    release_assoc = OpSysReleaseComponent()
                    release_assoc.release = release
                    # OpSysComponent.releases is a backref from OpSysReleaseComponent.
                    compobj.releases.append(release_assoc)  # pylint: disable=no-member
                self.add(compobj)
        self.commit()
Esempio n. 4
0
    def basic_fixtures(self, flush=True):
        """
        Add Arch, OpSys, OpSysRelease and OpSysComponent fixtures

        Store as self.arch_noarch, self_opsys_fedora, self.release_19,
        self.comp_kernel, ...
        """

        for arch_name in Init.archs:
            arch = Arch(name=arch_name)
            self.db.session.add(arch)
            setattr(self, "arch_{0}".format(arch_name), arch)

        centos_sys = OpSys(name="CentOS")
        self.db.session.add(centos_sys)

        self.opsys_centos = centos_sys

        releases = []
        versions = ["6.7", "6.8", "7.1", "7.2", "7.3", "7.7"]
        for ver in versions:
            rel = OpSysRelease(opsys=centos_sys, version=ver, status="ACTIVE")

            releases.append(rel)
            self.db.session.add(rel)
            setattr(self, "release_{0}".format(ver), rel)

        sys = OpSys(name="Fedora")
        self.db.session.add(sys)

        self.opsys_fedora = sys

        releases = []
        for ver in range(17, 21):
            rel = OpSysRelease(opsys=sys, version=ver, status="ACTIVE")
            releases.append(rel)
            self.db.session.add(rel)
            setattr(self, "release_{0}".format(ver), rel)

        for cname in [
                "faf", "systemd", "kernel", "ibus-table", "eclipse",
                "will-crash", "ibus-table-ruby", "xorg-x11-drv-nouveau"
        ]:

            comp = OpSysComponent(opsys=sys, name=cname)
            self.db.session.add(comp)

            comp = OpSysComponent(opsys=centos_sys, name=cname)
            self.db.session.add(comp)

            setattr(self, "comp_{0}".format(cname), comp)

            for rel in releases:
                rcomp = OpSysReleaseComponent(release=rel, component=comp)
                self.db.session.add(rcomp)

        if flush:
            self.db.session.flush()