elasticluster.conf

class elasticluster.conf.ConfigReader(configfile)[source]

Reads the configuration properties from a ini file.

Parameters:configfile (str) – path to configfile
read_config()[source]

Reads the configuration properties from the ini file and links the section to comply with the cluster config dictionary format.

Returns:dictionary containing all configuration properties from the ini file in compliance to the cluster config format
Raises:voluptuous.MultipleInvalid if not all sections present or broken links between secitons
class elasticluster.conf.ConfigValidator(config)[source]

Validator for the cluster configuration dictionary.

Parameters:config – dictionary containing cluster configuration properties
validate()[source]

Validates the given configuration self.config to comply with elasticluster. As well all types are converted to the expected format if possible.

Raisegs:voluptuous.MultipleInvalid if multiple properties are not compliant
Raises:voluptuous.Invalid if one property is invalid
class elasticluster.conf.Configurator(cluster_conf, storage_path=None)[source]
The Configurator is responsible for (I) keeping track of the

configuration and (II) offer factory methods to create all kind of objects that need information from the configuration.

The cluster configuration dictionary is structured in the following way: (see an example @

{ "<cluster_template>" : {
    "setup" : { properties of the setup section },
    "cloud" : { properties of the cloud section },
    "login" : { properties of the login section },
    "cluster" : { properties of the cluster section },
    "nodes": {  "<node_kind>" : { properties of the node},
                "<node_kind>" : { properties of the node},
            },
    },
 "<cluster_template>" : {
    (see above)
    }
 }
Parameters:
  • cluster_conf (dict) – see description above
  • storage_path (str) – path to store data
Raises:

MultipleInvalid – configuration validation

create_cloud_provider(cluster_template)[source]

Creates a cloud provider by inspecting the configuration properties of the given cluster template.

Parameters:cluster_template (str) – template to use (if not already specified on init)
Returns:cloud provider that fulfills the contract of elasticluster.providers.AbstractSetupProvider
create_cluster(template, name=None)[source]

Creates a cluster by inspecting the configuration properties of the given cluster template.

Parameters:
  • template (str) – name of the cluster template
  • name (str) – name of the cluster. If not defined, the cluster

will be named after the template.

Returns:elasticluster.cluster.cluster instance
Raises:ConfigurationError – cluster template not found in config
create_setup_provider(cluster_template, name=None)[source]

Creates the setup provider for the given cluster template.

Parameters:
  • cluster_template (str) – template of the cluster
  • name (str) – name of the cluster to read configuration properties
classmethod fromConfig(configfile, storage_path=None)[source]

Helper method to initialize Configurator from an ini file.

Parameters:configfile (str) – path to the ini file
Returns:Configurator
load_cluster(cluster_name)[source]

Loads a cluster from the cluster repository.

Parameters:cluster_name (str) – name of the cluster
Returns:elasticluster.cluster.cluster instance