Esempio n. 1
0
 def nodes(self, setup_node_controller, request):
     if hasattr(request, 'param'):
         node_vars = self.override_node_parameters(**request.param)
     else:
         node_vars = env_variables
     net_asset = None
     needs_nat = node_vars.get("platform") == consts.Platforms.NONE
     try:
         if not qe_env:
             net_asset = NetworkAssets()
             node_vars["net_asset"] = net_asset.get()
         controller = setup_node_controller(**node_vars)
         nodes = Nodes(controller, node_vars["private_ssh_key_path"])
         nodes.prepare_nodes()
         if needs_nat:
             nodes.configure_nat()
         yield nodes
         if env_variables['test_teardown']:
             logging.info('--- TEARDOWN --- node controller\n')
             nodes.destroy_all_nodes()
         if needs_nat:
             nodes.unconfigure_nat()
     finally:
         if not qe_env:
             net_asset.release_all()
Esempio n. 2
0
        def get_nodes_func(config: TerraformConfig = TerraformConfig()):
            if "nodes" in nodes_data:
                return nodes_data["nodes"]

            nodes_data["needs_nat"] = config.platform == consts.Platforms.NONE
            nodes_data["net_asset"] = NetworkAssets()
            config.net_asset = nodes_data["net_asset"].get()

            nodes = Nodes(TerraformController(config), config.private_ssh_key_path)
            nodes.prepare_nodes()
            if nodes_data["needs_nat"]:
                nodes.configure_nat()

            nodes_data["nodes"] = nodes
            return nodes