def init(self, force_deploy=False): """Reserve and deploys the nodes according to the resources section In comparison to the vagrant provider, networks must be characterized as in the networks key. Args: provider_conf (dict): description of the resources and job information Examples: .. code-block:: yaml # in yaml --- job_name: enoslib walltime: 01:00:00 # will give all configured interfaces an IP dhcp: True # force_deploy: True resources: machines: - roles: [telegraf] cluster: griffon nodes: 1 primary_network: n1 secondary_networks: [] secondary_networks: [n2] - roles: - control registry prometheus grafana telegraf cluster: griffon nodes: 1 primary_network: n1 secondary_networks: [] secondary_networks: [n2] networks: - id: n1 roles: [control_network] type: prod site: nancy - id: n2 roles: [internal_network] type: kavlan-local site: nancy """ resources = self.provider_conf["resources"] r = api.Resources(resources) # insert force_deploy self.provider_conf.setdefault("force_deploy", force_deploy) r.launch(**self.provider_conf) roles = r.get_roles() networks = r.get_networks() return (_to_enos_roles(roles), _to_enos_networks(networks))
def init(self, force_deploy=False): """Reserve and deploys the nodes according to the resources section In comparison to the vagrant provider, networks must be characterized as in the networks key. Args: force_deploy (bool): True iff the environment must be redeployed Raises: MissingNetworkError: If one network is missing in comparison to what is claimed. NotEnoughNodesError: If the `min` constraints can't be met. """ self.provider_conf.setdefault("force_deploy", force_deploy) r = api.Resources(self.provider_conf) # insert force_deploy r.launch() roles = r.get_roles() networks = r.get_networks() return (_to_enos_roles(roles), _to_enos_networks(networks))
def destroy(self): """Destroys the jobs.""" r = api.Resources(self.provider_conf) # insert force_deploy r.destroy()