Mentions légales du service

Skip to content
Snippets Groups Projects
Forked from discovery / enoslib
Source project has a limited visibility.
  • SIMONIN Matthieu's avatar
    c6fb86ad
    Introduce a configuration object · c6fb86ad
    SIMONIN Matthieu authored
    ```
    from enoslib.infra.enos_g5k.provider import G5k
    from enoslib.infra.enos_g5k.configuration import Configuration
    
    conf = Configuration.from_dictionnary(provider_conf)
    provider = G5k(conf)
    roles, networks = provider.init()
    ```
    Note: Validation is done in the class method from_dictionnary.
    
    Additionnaly a programmatic way of creating configuration is provided :
    
    ```
    conf = Configuration()
    network = NetworkConfiguration(id="id",
                                   roles=["my_network"],
                                   type="prod",
                                   site="rennes")
    
    conf.add_network_conf(network)\
            .add_machine_conf(MachineConfiguration(roles=["r1"],
                         cluster="paravance",
                         primary_network=network))\
            .add_machine_conf(MachineConfiguration(roles=["r2"],
                         cluster="parapluie",
                         primary_network=network,
                         nodes=10))\
           .finalize()
    ```
    
    ```
    conf = Configuration()
    network = NetworkConfiguration(id="id",
                                   roles=["my_network"],
                                   type="prod",
                                   site="rennes")
    
    conf.add_network_conf(network)\
            .add_machine(roles=["r1"],
                         cluster="paravance",
                         primary_network=network)\
            .add_machine(roles=["r2"],
                         cluster="parapluie",
                         primary_network=network,
                         nodes=10)\
           .finalize()
    ```
    
    In this case validation is done when calling finalize.
    
    Refactor each provider code to split the configuration from the Provider
    object. This object is then passed to the provider which only read it and
    proceed with the deployment of the infrastructure.
    
    In each provider:
    - add a `configuration.py` which contains the definition of Configuration
    - add a `schema.py` which contains the schema
    - add a `constants.py` which contains the constants
    
    - Unit testing has been added as well as
    - functionnal tests adapted to the new API (mostly located in `docs/tutorials`)
    
    - Drop py27
    - In configuration schema, drop `role` keyword (keep only `roles`)
    - update doc
    Verified
    c6fb86ad
    History
    Introduce a configuration object
    SIMONIN Matthieu authored
    ```
    from enoslib.infra.enos_g5k.provider import G5k
    from enoslib.infra.enos_g5k.configuration import Configuration
    
    conf = Configuration.from_dictionnary(provider_conf)
    provider = G5k(conf)
    roles, networks = provider.init()
    ```
    Note: Validation is done in the class method from_dictionnary.
    
    Additionnaly a programmatic way of creating configuration is provided :
    
    ```
    conf = Configuration()
    network = NetworkConfiguration(id="id",
                                   roles=["my_network"],
                                   type="prod",
                                   site="rennes")
    
    conf.add_network_conf(network)\
            .add_machine_conf(MachineConfiguration(roles=["r1"],
                         cluster="paravance",
                         primary_network=network))\
            .add_machine_conf(MachineConfiguration(roles=["r2"],
                         cluster="parapluie",
                         primary_network=network,
                         nodes=10))\
           .finalize()
    ```
    
    ```
    conf = Configuration()
    network = NetworkConfiguration(id="id",
                                   roles=["my_network"],
                                   type="prod",
                                   site="rennes")
    
    conf.add_network_conf(network)\
            .add_machine(roles=["r1"],
                         cluster="paravance",
                         primary_network=network)\
            .add_machine(roles=["r2"],
                         cluster="parapluie",
                         primary_network=network,
                         nodes=10)\
           .finalize()
    ```
    
    In this case validation is done when calling finalize.
    
    Refactor each provider code to split the configuration from the Provider
    object. This object is then passed to the provider which only read it and
    proceed with the deployment of the infrastructure.
    
    In each provider:
    - add a `configuration.py` which contains the definition of Configuration
    - add a `schema.py` which contains the schema
    - add a `constants.py` which contains the constants
    
    - Unit testing has been added as well as
    - functionnal tests adapted to the new API (mostly located in `docs/tutorials`)
    
    - Drop py27
    - In configuration schema, drop `role` keyword (keep only `roles`)
    - update doc