示例#1
0
def systems_edit_profile(profile_name, new_profile_name):
    out = subprocess.call_output(
        ["cobbler", "system", "find", "--profile", profile_name])
    system_names = out.strip().split()
    for system_name in system_names:
        subprocess.call(["cobbler", "system", "edit",
                         "--name", system_name, "--profile", new_profile_name])
示例#2
0
def stop_container(container):
    _container_action(container, "stop")
    container_id = subprocess.call_output([
        'docker',
        'ps',
        '--filter',
        'name={0}'.format(container),
        '--format',
        '{{.ID}}'
    ]).strip()
    if container_id:
        subprocess.call(["docker", "stop", container_id])
示例#3
0
文件: env.py 项目: Vegasq/fuel-octane
def clone_env(env_id, release):
    LOG.info("Cloning env %s for release %s", env_id, release.data['name'])
    res = subprocess.call_output(
        ["fuel2", "env", "clone", "-f", "json",
         str(env_id), uuid.uuid4().hex, str(release.data['id'])],
    )
    for kv in json.loads(res):
        if kv['Field'] == 'id':
            seed_id = kv['Value']
            break
    else:
        raise Exception("Couldn't find new environment ID in fuel CLI output:"
                        "\n%s" % res)
    return seed_id
示例#4
0
def clone_env(env_id, release):
    LOG.info("Cloning env %s for release %s", env_id, release.data['name'])
    res = subprocess.call_output([
        "fuel2", "env", "clone", "-f", "json",
        str(env_id),
        uuid.uuid4().hex,
        str(release.data['id'])
    ], )
    for kv in json.loads(res):
        if kv['Field'] == 'id':
            seed_id = kv['Value']
            break
    else:
        raise Exception("Couldn't find new environment ID in fuel CLI output:"
                        "\n%s" % res)
    return seed_id
示例#5
0
def get_not_active_images_uuids():
    fuel_bootstrap_list = ["fuel-bootstrap", "list", "--format", "json"]
    images = json.loads(subprocess.call_output(fuel_bootstrap_list))
    return [img["uuid"] for img in images if img["status"] != "active"]
示例#6
0
文件: ssh.py 项目: rmoe/fuel-octane
def call_output(cmd, **kwargs):
    return subprocess.call_output(cmd, popen_class=SSHPopen, **kwargs)
示例#7
0
def profile_exists(name):
    out = subprocess.call_output(
        ["cobbler", "profile", "find", "--name", name])
    return bool(out.strip())
示例#8
0
def fuel2_env_call(args, output=False):
    cmd = ["fuel2", "--debug", "env"] + args
    if output:
        return subprocess.call_output(cmd)
    else:
        subprocess.call(cmd)
示例#9
0
def run_psql(sql, db):
    output = subprocess.call_output(
        ["sudo", "-u", "postgres", "psql", db, "--tuples-only", "--no-align",
         "-c", sql])
    return output.strip().splitlines()