コード例 #1
0
ファイル: cobbler.py プロジェクト: openstack/fuel-octane
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
ファイル: docker.py プロジェクト: openstack/fuel-octane
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
ファイル: cobbler.py プロジェクト: openstack/fuel-octane
def profile_exists(name):
    out = subprocess.call_output(
        ["cobbler", "profile", "find", "--name", name])
    return bool(out.strip())
コード例 #8
0
ファイル: env.py プロジェクト: openstack/fuel-octane
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
ファイル: sql.py プロジェクト: openstack/fuel-octane
def run_psql(sql, db):
    output = subprocess.call_output(
        ["sudo", "-u", "postgres", "psql", db, "--tuples-only", "--no-align",
         "-c", sql])
    return output.strip().splitlines()