Ejemplo n.º 1
0
def clusters_get(cluster_id):
    c = None
    try:
        c = api.get_cluster(id=cluster_id)
    except Exception, e:
        abort_and_log(500, 'Exception while getting Cluster with id '
                           '\'%s\'' % cluster_id, e)
Ejemplo n.º 2
0
def check_cluster_scaling(data, cluster_id, **kwargs):
    cluster = api.get_cluster(id=cluster_id)
    if not (plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                     'scale_cluster') and
            (plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                      'decommission_nodes'))):
        raise ex.InvalidException(
            "Requested plugin '%s' doesn't support cluster scaling feature" %
            cluster.plugin_name)

    if cluster.status != 'Active':
        raise ex.InvalidException("Cluster cannot be scaled not in 'Active' "
                                  "status. Cluster status: " + cluster.status)

    if data.get("resize_node_groups"):
        b.check_resize(cluster, data['resize_node_groups'])

    if data.get("add_node_groups"):
        b.check_add_node_groups(cluster, data['add_node_groups'])
Ejemplo n.º 3
0
def check_cluster_scaling(data, cluster_id, **kwargs):
    cluster = api.get_cluster(id=cluster_id)
    if not (plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                     'scale_cluster') and (
            plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                     'decommission_nodes'))):
        raise ex.InvalidException(
            "Requested plugin '%s' doesn't support cluster scaling feature"
            % cluster.plugin_name)

    if cluster.status != 'Active':
        raise ex.InvalidException("Cluster cannot be scaled not in 'Active' "
                                  "status. Cluster status: " + cluster.status)

    if data.get("resize_node_groups"):
        b.check_resize(cluster, data['resize_node_groups'])

    if data.get("add_node_groups"):
        b.check_add_node_groups(cluster, data['add_node_groups'])
Ejemplo n.º 4
0
def clusters_get(cluster_id):
    return u.render(api.get_cluster(cluster_id).to_wrapped_dict())
Ejemplo n.º 5
0
def clusters_get(cluster_id):
    return u.render(api.get_cluster(id=cluster_id).wrapped_dict)
Ejemplo n.º 6
0
def clusters_get(cluster_id):
    return u.render(api.get_cluster(cluster_id).to_wrapped_dict())
Ejemplo n.º 7
0
def check_cluster_exists(id):
    if not api.get_cluster(id):
        raise ex.InvalidException("Cluster with id '%s'" " doesn't exist" % id)
Ejemplo n.º 8
0
def clusters_get(cluster_id):
    tenant_id = request.headers['X-Tenant-Id']
    c = api.get_cluster(id=cluster_id, tenant_id=tenant_id)
    return api_u.render(c.wrapped_dict)
Ejemplo n.º 9
0
def check_cluster_exists(id):
    if not api.get_cluster(id):
        raise ex.InvalidException("Cluster with id '%s'"
                                  " doesn't exist" % id)