Exemple #1
0
def getAllHosts():
    con = uSysDB.connect()
    cur = con.cursor()
    cur.execute(
        "SELECT h.host_id, h.primary_name, h.htype, p.opsys, p.osrel, p.arch, default_rootpath, h.pleskd_id, h.note FROM hosts h JOIN platforms p ON (p.platform_id = h.platform_id) WHERE h.deleting != 1 ORDER BY h.host_id ASC")

    return [uUtil.PEMHost(row[0], row[1], row[2], uBuild.Platform(row[3], row[4], row[5]), row[6], row[7], row[8]) for row in cur.fetchall()]
Exemple #2
0
def getPlatform(con, platform_id):
    cur = con.cursor()
    cur.execute("SELECT opsys, osrel, arch FROM platforms WHERE platform_id = %s", platform_id)
    row = cur.fetchone()
    if not row:
        return None
    p = uBuild.Platform(row[0], row[1], row[2])
    p.platform_id = platform_id
    return p
Exemple #3
0
def listImportedPackages():
    packages = []
    for pkg_id, name, ctype, version, is_single, is_custom, opsys, osrel, arch in _listImportedPackages(
    ):
        platform = uBuild.Platform(opsys, osrel, arch)
        package = uBuild.Package(name, ctype, platform, is_single, is_custom)
        built_package = uBuild.BuiltPackage(package, version)
        built_package.pkg_id = pkg_id
        packages.append(built_package)
    return packages
Exemple #4
0
def getHost(host_id):
    """
    :param host_id:
    :return: uUtil.PEMHost
    """
    con = uSysDB.connect()
    cur = con.cursor()
    cur.execute(
        "SELECT h.host_id, h.primary_name, h.htype, p.opsys, p.osrel, p.arch, default_rootpath, h.pleskd_id, h.note FROM hosts h JOIN platforms p ON (p.platform_id = h.platform_id) WHERE host_id = %s", host_id)

    row = cur.fetchone()
    return uUtil.PEMHost(row[0], row[1], row[2], uBuild.Platform(row[3], row[4], row[5]), row[6], row[7], row[8])
Exemple #5
0
def getHostInfo(con, host_id):
    cur = con.cursor()
    cur.execute(
        "SELECT p.opsys, p.osrel, p.arch, h.default_rootpath, p.platform_id FROM platforms p JOIN hosts h ON (h.platform_id = p.platform_id) WHERE h.host_id = %s", host_id)
    row = cur.fetchone()

    if not row:
        raise Exception("Database inconsistency - there is host with id %s!" % host_id)

    platform = uBuild.Platform(row[0], row[1], row[2])
    platform.platform_id = row[4]
    rootpath = row[3]
    cur.close()
    return platform, rootpath
Exemple #6
0
def determinePlatform():
    pver = platform.version().split('.')
    pVerShort = ".".join(pver[:2])
    p = uBuild.Platform(Const.getOsaWinPlatform(), pVerShort, "x86_64")  # POA uses 2-numbered windows version like 5.2
    p.osverfull = pver		# leave scalar version in osver for compatibility with 5.5
    return p