예제 #1
0
def openstack_clouds(config=None,
                     debug=False,
                     cloud=None,
                     strict=False,
                     app_name=None,
                     app_version=None):
    if not config:
        config = _get_openstack_config(app_name, app_version)
    try:
        if cloud is None:
            return [
                OpenStackCloud(cloud=f.name,
                               debug=debug,
                               cloud_config=f,
                               strict=strict,
                               **f.config) for f in config.get_all_clouds()
            ]
        else:
            return [
                OpenStackCloud(cloud=f.name,
                               debug=debug,
                               cloud_config=f,
                               strict=strict,
                               **f.config) for f in config.get_all_clouds()
                if f.name == cloud
            ]
    except keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin as e:
        raise OpenStackCloudException(
            "Invalid cloud configuration: {exc}".format(exc=str(e)))
예제 #2
0
파일: __init__.py 프로젝트: rodvic/shade
def openstack_cloud(config=None, strict=False, **kwargs):
    if not config:
        config = os_client_config.OpenStackConfig()
    try:
        cloud_config = config.get_one_cloud(**kwargs)
    except keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin as e:
        raise OpenStackCloudException(
            "Invalid cloud configuration: {exc}".format(exc=str(e)))
    return OpenStackCloud(cloud_config=cloud_config, strict=strict)
예제 #3
0
def openstack_clouds(config=None, debug=False):
    if not config:
        config = os_client_config.OpenStackConfig()
    try:
        return [
            OpenStackCloud(cloud=f.name,
                           debug=debug,
                           cloud_config=f,
                           **f.config) for f in config.get_all_clouds()
        ]
    except keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin as e:
        raise OpenStackCloudException(
            "Invalid cloud configuration: {exc}".format(exc=str(e)))
예제 #4
0
def openstack_cloud(config=None,
                    strict=False,
                    app_name=None,
                    app_version=None,
                    use_direct_get=False,
                    **kwargs):
    if not config:
        config = _get_openstack_config(app_name, app_version)
    try:
        cloud_config = config.get_one_cloud(**kwargs)
    except keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin as e:
        raise exc.OpenStackCloudException(
            "Invalid cloud configuration: {exc}".format(exc=str(e)))
    return OpenStackCloud(cloud_config=cloud_config,
                          strict=strict,
                          use_direct_get=use_direct_get)