def check_cluster_template_update(cluster_template_id, data, **kwargs): if data.get('plugin_name') and not data.get('hadoop_version'): raise ex.InvalidReferenceException( _("You must specify a hadoop_version value " "for your plugin_name")) if data.get('plugin_name'): plugin = data['plugin_name'] version = data['hadoop_version'] b.check_plugin_name_exists(plugin) b.check_plugin_supports_version(plugin, version) b.check_all_configurations(data) else: cluster_template = api.get_cluster_template(cluster_template_id) plugin = cluster_template.plugin_name if data.get('hadoop_version'): version = data.get('hadoop_version') b.check_plugin_supports_version(plugin, version) else: version = cluster_template.hadoop_version if data.get('default_image_id'): b.check_image_registered(data['default_image_id']) b.check_required_image_tags(plugin, version, data['default_image_id']) if data.get('anti_affinity'): b.check_node_processes(plugin, version, data['anti_affinity']) if data.get('neutron_management_network'): b.check_network_exists(data['neutron_management_network']) if data.get('shares'): shares.check_shares(data['shares'])
def check_node_groups_in_cluster_templates(cluster_name, plugin_name, hadoop_version, cluster_template_id): c_t = api.get_cluster_template(id=cluster_template_id) n_groups = c_t.to_wrapped_dict()["cluster_template"]["node_groups"] proxy_gateway_used = len([ng for ng in n_groups if ng.get("is_proxy_gateway", False)]) > 0 check_network_config(n_groups, proxy_gateway_used) for node_group in n_groups: check_node_group_basic_fields(plugin_name, hadoop_version, node_group) check_cluster_hostnames_lengths(cluster_name, n_groups)
def check_node_groups_in_cluster_templates(cluster_name, plugin_name, hadoop_version, cluster_template_id): c_t = api.get_cluster_template(id=cluster_template_id) n_groups = c_t.to_wrapped_dict()['cluster_template']['node_groups'] for node_group in n_groups: check_node_group_basic_fields(plugin_name, hadoop_version, node_group) check_cluster_hostnames_lengths(cluster_name, n_groups)
def check_node_groups_in_cluster_templates(cluster_name, plugin_name, hadoop_version, cluster_template_id): c_t = api.get_cluster_template(id=cluster_template_id) n_groups = c_t.to_wrapped_dict()['cluster_template']['node_groups'] proxy_gateway_used = len([ng for ng in n_groups if ng.get('is_proxy_gateway', False)]) > 0 check_network_config(n_groups, proxy_gateway_used) for node_group in n_groups: check_node_group_basic_fields(plugin_name, hadoop_version, node_group) check_cluster_hostnames_lengths(cluster_name, n_groups)
def _get_cluster_field(cluster, field): if cluster.get(field): return cluster[field] if cluster.get("cluster_template_id"): cluster_template = api.get_cluster_template(id=cluster["cluster_template_id"]) if cluster_template.get(field): return cluster_template[field] return None
def _get_cluster_field(cluster, field): if cluster.get(field): return cluster[field] if cluster.get('cluster_template_id'): cluster_template = api.get_cluster_template( id=cluster['cluster_template_id']) if cluster_template.get(field): return cluster_template[field] return None
def check_cluster_template_exists(cluster_template_id): if not api.get_cluster_template(id=cluster_template_id): raise ex.NotFoundException(cluster_template_id, _("Cluster template with id '%s' not found"))
def check_cluster_template_exists(cluster_template_id): if not api.get_cluster_template(id=cluster_template_id): raise ex.NotFoundException( cluster_template_id, _("Cluster template with id '%s' not found"))