コード例 #1
0
def delete(environment, name, config, pwd):
    ik_driver = get_ik_driver(environment, config, pwd)
    with lm_driver_safety_net():
        ik = ik_driver.get_infrastructure_key_by_name(name)
    if ik is None:
        click.echo('Error: No infrastructure key with name: {0}'.format(name),
                   err=True)
        exit(1)
    ik_name = ik['name']
    click.echo('Deleting infrastructure key: {0}...'.format(ik_name))
    with lm_driver_safety_net():
        ik_driver.delete_infrastructure_key(ik_name)
    click.echo('Deleted infrastructure key: {0}'.format(ik_name))
コード例 #2
0
def get(environment, driver_id, config, pwd, lifecycle_type, output_format):
    """Get VIM driver"""
    lifecycle_mgmt_driver = get_lifecycle_driver_mgmt_driver(environment, config, pwd)
    if driver_id is None:
        if lifecycle_type is None:
            click.echo('Error: Must specify driver-id argument or type option')
            exit(1)
        with lm_driver_safety_net():
            lifecycle_driver = lifecycle_mgmt_driver.get_lifecycle_driver_by_type(lifecycle_type)
    else:
        with lm_driver_safety_net():
            lifecycle_driver = lifecycle_mgmt_driver.get_lifecycle_driver(driver_id)
    click.echo(format_lifecycle_driver(output_format, lifecycle_driver))
コード例 #3
0
ファイル: deployment_location.py プロジェクト: IBM/lmctl
def delete(environment, name, config, pwd):
    dl_driver = get_dl_driver(environment, config, pwd)
    with lm_driver_safety_net():
        dl_list = dl_driver.get_locations_by_name(name)
    if len(dl_list) == 0:
        click.echo('Error: No deployment location with name: {0}'.format(name),
                   err=True)
        exit(1)
    matched_dl = dl_list[0]
    dl_id = matched_dl['id']
    click.echo('Deleting deployment location: {0}...'.format(dl_id))
    with lm_driver_safety_net():
        dl_driver.delete_location(dl_id)
    click.echo('Deleted deployment location: {0}'.format(dl_id))
コード例 #4
0
def delete(environment, driver_id, config, pwd, lifecycle_type):
    """Remove a Lifecycle driver by ID or type"""
    lifecycle_mgmt_driver = get_lifecycle_driver_mgmt_driver(environment, config, pwd)
    if driver_id is None:
        if lifecycle_type is None:
            click.echo('Error: Must specify driver-id argument or type option')
            exit(1)
        with lm_driver_safety_net():
            lifecycle_driver = lifecycle_mgmt_driver.get_lifecycle_driver_by_type(lifecycle_type)
        driver_id = lifecycle_driver['id']
        click.echo('Found lifecycle driver matching type \'{0}\'. Id: {1}'.format(lifecycle_type, driver_id))
    click.echo('Deleting lifecycle driver: {0}...'.format(driver_id))
    with lm_driver_safety_net():
        lifecycle_mgmt_driver.delete_lifecycle_driver(driver_id)
    click.echo('Deleted lifecycle driver: {0}'.format(driver_id))
コード例 #5
0
ファイル: vimdriver.py プロジェクト: IBM/lmctl
def delete(environment, driver_id, config, pwd, inf_type):
    """Remove a VIM driver by ID or type"""
    vim_mgmt_driver = get_vim_driver_mgmt_driver(environment, config, pwd)
    if driver_id is None:
        if inf_type is None:
            click.echo('Error: Must specify driver-id argument or type option')
            exit(1)
        with lm_driver_safety_net():
            vim_driver = vim_mgmt_driver.get_vim_driver_by_type(inf_type)
        driver_id = vim_driver['id']
        click.echo('Found VIM driver matching type \'{0}\'. Id: {1}'.format(
            inf_type, driver_id))
    click.echo('Deleting VIM driver: {0}...'.format(driver_id))
    with lm_driver_safety_net():
        vim_mgmt_driver.delete_vim_driver(driver_id)
    click.echo('Deleted VIM driver: {0}'.format(driver_id))
コード例 #6
0
ファイル: deployment_location.py プロジェクト: IBM/lmctl
def get(environment, name, config, pwd, output_format):
    dl_driver = get_dl_driver(environment, config, pwd)
    with lm_driver_safety_net():
        dl_list = dl_driver.get_locations_by_name(name)
    if len(dl_list) == 0:
        click.echo('Error: No deployment location with name: {0}'.format(name),
                   err=True)
        exit(1)
    matched_dl = dl_list[0]
    click.echo(format_dl(output_format, matched_dl))
コード例 #7
0
def get(environment, name, config, pwd, output_format):
    """Get infrastructure key"""
    infrastructure_keys = get_ik_driver(environment, config, pwd)
    with lm_driver_safety_net():
        infrastructure_key = infrastructure_keys.get_infrastructure_key_by_name(
            name)
    if infrastructure_key is None:
        click.echo('Error: No infrastructure key with name: {0}'.format(name),
                   err=True)
        exit(1)
    else:
        click.echo(format_ik(output_format, infrastructure_key))
コード例 #8
0
ファイル: vimdriver.py プロジェクト: IBM/lmctl
def add(environment, config, pwd, inf_type, url, certificate, output_format):
    """Add a VIM driver"""
    vim_mgmt_driver = get_vim_driver_mgmt_driver(environment, config, pwd)
    new_vim_driver = {'infrastructureType': inf_type, 'baseUri': url}

    if certificate is not None:
        try:
            new_vim_driver['certificate'] = read_certificate_file(certificate)
        except IOError as e:
            click.echo('Error: reading certificate: {0}'.format(str(e)),
                       err=True)
            exit(1)

    with lm_driver_safety_net():
        vim_driver = vim_mgmt_driver.add_vim_driver(new_vim_driver)
    click.echo(format_vim_driver(output_format, vim_driver))
コード例 #9
0
ファイル: deployment_location.py プロジェクト: IBM/lmctl
def add(environment, name, config, pwd, rm, infrastructure_type, description,
        properties, output_format):
    dl_driver = get_dl_driver(environment, config, pwd)
    new_dl = {
        'name': name,
        'description': description,
        'resourceManager': rm,
        'infrastructureType': infrastructure_type
    }
    if properties is not None:
        loaded_properties = load_properties_file(properties)
        new_dl['infrastructureSpecificProperties'] = loaded_properties
    else:
        new_dl['infrastructureSpecificProperties'] = {}
    with lm_driver_safety_net():
        new_dl = dl_driver.add_location(new_dl)
    click.echo(format_dl(output_format, new_dl))
コード例 #10
0
def add(environment, config, pwd, lifecycle_type, url, certificate, output_format):
    """Add a lifecycle driver"""
    lifecycle_mgmt_driver = get_lifecycle_driver_mgmt_driver(environment, config, pwd)
    new_lifecycle_driver = {
        'type': lifecycle_type,
        'baseUri': url
    }

    if certificate is not None:
        try:
            new_lifecycle_driver['certificate'] = read_certificate_file(certificate)
        except IOError as e:
            click.echo('Error: reading certificate: {0}'.format(str(e)), err=True)
            exit(1)

    with lm_driver_safety_net():
        lifecycle_driver = lifecycle_mgmt_driver.add_lifecycle_driver(new_lifecycle_driver)
    click.echo(format_lifecycle_driver(output_format, lifecycle_driver))
コード例 #11
0
def add(environment, name, config, pwd, public_key, private_key, description,
        output_format):
    ik_driver = get_ik_driver(environment, config, pwd)
    new_ik = {
        'name': name,
    }

    if description is not None:
        new_ik['description'] = description

    if public_key is not None:
        loaded_public = load_key_file(public_key, 'public')
        new_ik['publicKey'] = loaded_public

    if private_key is not None:
        loaded_private = load_key_file(private_key, 'private')
        new_ik['privateKey'] = loaded_private

    with lm_driver_safety_net():
        new_ik = ik_driver.add_infrastructure_key(new_ik)
    click.echo(format_ik(output_format, new_ik))
コード例 #12
0
ファイル: deployment_location.py プロジェクト: IBM/lmctl
def list_locations(environment, config, pwd, output_format):
    dl_driver = get_dl_driver(environment, config, pwd)
    with lm_driver_safety_net():
        dl_list = dl_driver.get_locations()
    result = format_dl_list(output_format, dl_list)
    click.echo(result)
コード例 #13
0
def list_keys(environment, config, pwd, output_format):
    ik_driver = get_ik_driver(environment, config, pwd)
    with lm_driver_safety_net():
        ik_list = ik_driver.get_infrastructure_keys()
    result = format_ik_list(output_format, ik_list)
    click.echo(result)