Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 def __test_cases_from_cluster(self, cases, test):
     """
     Tests all cases by manually loading a cluster template using the
     Cluster class. All settings for a case are passed in as constructor
     keywords.  Avoids the config module by using the Cluster object
     directly to create a test case.
     """
     failed = []
     for case in cases:
         cluster = Cluster(**case)
         try:
             getattr(cluster, test)()
         except exception.ClusterValidationError:
             continue
         else:
             failed.append(case)
     return failed
Exemplo n.º 3
0
    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 specified, will be passed to Cluster instance
        as cluster_tag
        """
        try:
            kwargs = {}
            if tag_name:
                kwargs.update(dict(cluster_tag=tag_name))
            kwargs.update(self.clusters[template_name])
            if not ec2_conn:
                ec2_conn = self.get_easy_ec2()
            clust = Cluster(ec2_conn, **kwargs)
            return clust
        except KeyError:
            raise exception.ClusterTemplateDoesNotExist(template_name)
Exemplo n.º 4
0
    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)