def get_cluster_template(self, template_name, tag_name=None, ec2_conn=None): """ Returns Cluster instance configured with the settings in the config file. template_name is the name of a cluster section defined in the config tag_name if not specified will be set to template_name """ try: kwargs = {} tag_name = tag_name or template_name kwargs.update(dict(cluster_tag=tag_name)) kwargs.update(self.clusters[template_name]) plugs = kwargs.get('plugins') kwargs['plugins'] = deathrow._load_plugins(plugs, debug=DEBUG_CONFIG) if not ec2_conn: ec2_conn = self.get_easy_ec2() clust = Cluster(ec2_conn, **kwargs) return clust except KeyError: raise exception.ClusterTemplateDoesNotExist(template_name)
def get_cluster_template(self, template_name, tag_name=None, ec2_conn=None, load_plugins=True): """ Returns Cluster instance configured with the settings in the config file. template_name is the name of a cluster section defined in the config tag_name if not specified will be set to template_name """ try: kwargs = {} tag_name = tag_name or template_name kwargs.update(dict(cluster_tag=tag_name)) kwargs.update(self.clusters[template_name]) plugs = kwargs.get('plugins') plugins_order = [] for p in plugs: plugins_order.append(p["setup_class"].split(".")[-1]) kwargs['plugins_order'] = plugins_order if load_plugins: kwargs['plugins'] = deathrow._load_plugins(plugs, debug=DEBUG_CONFIG) else: kwargs['plugins'] = [] if not ec2_conn: ec2_conn = self.get_easy_ec2() del kwargs['__name__'] del kwargs['extends'] clust = Cluster(ec2_conn, **kwargs) return clust except KeyError: raise exception.ClusterTemplateDoesNotExist(template_name)