コード例 #1
0
def check_node_group_template_usage(node_group_template_id, **kwargs):
    cluster_users = []
    template_users = []

    for cluster in api.get_clusters():
        if (node_group_template_id in [
                node_group.node_group_template_id
                for node_group in cluster.node_groups
        ]):
            cluster_users += [cluster.name]

    for cluster_template in api.get_cluster_templates():
        if (node_group_template_id in [
                node_group.node_group_template_id
                for node_group in cluster_template.node_groups
        ]):
            template_users += [cluster_template.name]

    if cluster_users or template_users:
        raise ex.InvalidException(
            _("Node group template %(template)s is in use by "
              "cluster templates: %(users)s; and clusters: %(clusters)s") %
            {
                'template': node_group_template_id,
                'users': template_users and ', '.join(template_users) or 'N/A',
                'clusters': cluster_users and ', '.join(cluster_users) or 'N/A'
            })
コード例 #2
0
def check_node_group_template_usage(node_group_template_id, **kwargs):
    cluster_users = []
    template_users = []

    for cluster in api.get_clusters():
        if (node_group_template_id in
            [node_group.node_group_template_id
             for node_group in cluster.node_groups]):
            cluster_users += [cluster.name]

    for cluster_template in api.get_cluster_templates():
        if (node_group_template_id in
            [node_group.node_group_template_id
             for node_group in cluster_template.node_groups]):
            template_users += [cluster_template.name]

    if cluster_users or template_users:
        raise ex.InvalidException(
            _("Node group template %(template)s is in use by "
              "cluster templates: %(users)s; and clusters: %(clusters)s") %
            {'template': node_group_template_id,
             'users': template_users and ', '.join(template_users) or 'N/A',
             'clusters': cluster_users and ', '.join(cluster_users) or 'N/A'})
コード例 #3
0
ファイル: base.py プロジェクト: B-Rich/sahara
def check_cluster_template_unique_name(name):
    if name in [t.name for t in api.get_cluster_templates()]:
        raise ex.NameAlreadyExistsException("Cluster template with name '%s'"
                                            " already exists" % name)
コード例 #4
0
ファイル: base.py プロジェクト: savi-dev/sahara
def check_cluster_template_unique_name(name):
    if name in [t.name for t in api.get_cluster_templates()]:
        raise ex.NameAlreadyExistsException("Cluster template with name '%s'"
                                            " already exists" % name)
コード例 #5
0
ファイル: v10.py プロジェクト: qinweiwei/sahara
def cluster_templates_list():
    return u.render(
        cluster_templates=[t.to_dict() for t in api.get_cluster_templates()])
コード例 #6
0
def cluster_templates_list():
    return u.render(cluster_templates=[
        t.to_dict()
        for t in api.get_cluster_templates(**u.get_request_args().to_dict())
    ])
コード例 #7
0
ファイル: v10.py プロジェクト: egafford/sahara
def cluster_templates_list():
    return u.render(
        cluster_templates=[t.to_dict() for t in api.get_cluster_templates(
            **u.get_request_args().to_dict())])
コード例 #8
0
def cluster_templates_list():
    return u.render(
        cluster_templates=[t.to_dict() for t in api.get_cluster_templates()])