def check_node_group_template_usage(node_group_template_id, **kwargs): node_groups = [] for cluster in api.get_clusters(): node_groups += cluster.node_groups for cluster_template in api.get_cluster_templates(): node_groups += cluster_template.node_groups node_group_template_ids = set( [node_group.node_group_template_id for node_group in node_groups]) if node_group_template_id in node_group_template_ids: raise ex.InvalidException("Node group template %s is use" % node_group_template_id)
def check_node_group_template_usage(node_group_template_id, **kwargs): node_groups = [] for cluster in api.get_clusters(): node_groups += cluster.node_groups for cluster_template in api.get_cluster_templates(): node_groups += cluster_template.node_groups node_group_template_ids = set([node_group.node_group_template_id for node_group in node_groups]) if node_group_template_id in node_group_template_ids: raise ex.InvalidException( "Node group template %s in use" % node_group_template_id)
def check_cluster_template_exists(cluster_template_id): if not api.get_cluster_templates(id=cluster_template_id): raise ex.InvalidException("Cluster template with id '%s'" " doesn't exist" % cluster_template_id)
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)
def cluster_templates_list(): return u.render( cluster_templates=[t.to_dict() for t in api.get_cluster_templates()])