Esempio n. 1
0
 def get_default_cluster_template(self):
     """
     Returns the default_template specified in the [global] section
     of the config. Raises NoDefaultTemplateFound if no default cluster
     template has been specified in the config.
     """
     default = self.globals.get('default_template')
     if not default:
         raise exception.NoDefaultTemplateFound(
             options=self.clusters.keys())
     if default not in self.clusters:
         raise exception.ClusterTemplateDoesNotExist(default)
     return default
Esempio n. 2
0
 def get_default_cluster_template(self):
     """
     Returns the cluster template with "DEFAULT=True" in the config
     If more than one found, raises MultipleDefaultTemplates exception.
     If no cluster template has "DEFAULT=True", raises
     NoDefaultTemplateFound exception.
     """
     default = self.globals.get('default_template')
     if not default:
         raise exception.NoDefaultTemplateFound(
             options=self.clusters.keys())
     if not default in self.clusters:
         raise exception.ClusterTemplateDoesNotExist(default)
     return default