Esempio n. 1
0
def get_all_osvariants():
    cmd = ["osinfo-query", "os", "-f", "short-id"]
    c.debug("Executing: {}".format(" ".join(cmd)))
    try:
        out = subprocess.check_output(cmd)
    except:
        print(c.RED("Error executing osinfo-query; install libosinfo rpm\n"))
        raise
    allVariants = ["auto"]
    for line in out.splitlines()[2:]:
        allVariants.append(line.strip())
    return allVariants
Esempio n. 2
0
def get_all_osvariants():
    cmd = ['osinfo-query', 'os', '-f', 'short-id']
    c.debug("Executing: {}".format(" ".join(cmd)))
    try:
        out = subprocess.check_output(cmd)
    except:
        print(c.RED("Error executing osinfo-query; install libosinfo rpm\n"))
        raise
    allVariants = ['auto']
    for line in out.splitlines()[2:]:
        allVariants.append(line.strip().decode('utf-8'))
    return allVariants
Esempio n. 3
0
def build_initial_cache():
    if os.path.isdir(cfg.tabCacheDir):
        return
    c.debug("Building initial cache")
    refresh_cache()
Esempio n. 4
0
def update_cache_file(outfile, input):
    outfile = "{}/{}".format(cfg.tabCacheDir, outfile)
    c.debug("Updating cache file {}".format(outfile))
    with open(outfile, "w") as f:
        json.dump(input, f)
Esempio n. 5
0
def build_initial_cache():
    if os.path.isdir(cfg.tabCacheDir):
        return
    c.debug("Building initial cache")
    refresh_cache()
Esempio n. 6
0
def update_cache_file(outfile, input):
    outfile = "{}/{}".format(cfg.tabCacheDir, outfile)
    c.debug("Updating cache file {}".format(outfile))
    with open(outfile, 'w') as f:
        json.dump(input, f)