Introduce a configuration object
``` 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
Showing
- .gitlab-ci.yml 0 additions, 7 deletions.gitlab-ci.yml
- .travis.yml 0 additions, 1 deletion.travis.yml
- docs/apidoc/infra.rst 63 additions, 9 deletionsdocs/apidoc/infra.rst
- docs/tutorials/chameleon.rst 23 additions, 4 deletionsdocs/tutorials/chameleon.rst
- docs/tutorials/chameleon/tuto_chameleonbaremetal.py 39 additions, 0 deletionsdocs/tutorials/chameleon/tuto_chameleonbaremetal.py
- docs/tutorials/grid5000.rst 49 additions, 10 deletionsdocs/tutorials/grid5000.rst
- docs/tutorials/grid5000/hosts 3 additions, 3 deletionsdocs/tutorials/grid5000/hosts
- docs/tutorials/grid5000/tuto_grid5000.py 12 additions, 6 deletionsdocs/tutorials/grid5000/tuto_grid5000.py
- docs/tutorials/grid5000/tuto_grid5000_non_deploy.py 6 additions, 3 deletionsdocs/tutorials/grid5000/tuto_grid5000_non_deploy.py
- docs/tutorials/grid5000/tuto_grid5000_non_deploy_p.py 39 additions, 0 deletionsdocs/tutorials/grid5000/tuto_grid5000_non_deploy_p.py
- docs/tutorials/grid5000/tuto_grid5000_p.py 38 additions, 0 deletionsdocs/tutorials/grid5000/tuto_grid5000_p.py
- docs/tutorials/grid5000/tuto_grid5000_subnet.py 6 additions, 4 deletionsdocs/tutorials/grid5000/tuto_grid5000_subnet.py
- docs/tutorials/grid5000/tuto_grid5000_subnet_p.py 53 additions, 0 deletionsdocs/tutorials/grid5000/tuto_grid5000_subnet_p.py
- docs/tutorials/grid5000/virt/tuto_grid5000_virt.py 24 additions, 29 deletionsdocs/tutorials/grid5000/virt/tuto_grid5000_virt.py
- docs/tutorials/using-tasks/_tmp_enos_/enos-0.out 8 additions, 8 deletionsdocs/tutorials/using-tasks/_tmp_enos_/enos-0.out
- docs/tutorials/using-tasks/hosts 2 additions, 2 deletionsdocs/tutorials/using-tasks/hosts
- docs/tutorials/using-tasks/step1.py 6 additions, 3 deletionsdocs/tutorials/using-tasks/step1.py
- docs/tutorials/using-tasks/step2.py 5 additions, 6 deletionsdocs/tutorials/using-tasks/step2.py
- docs/tutorials/using-tasks/step3.py 5 additions, 6 deletionsdocs/tutorials/using-tasks/step3.py
- docs/tutorials/vagrant.rst 11 additions, 0 deletionsdocs/tutorials/vagrant.rst
Loading
Please register or sign in to comment