def get_nodes_func(tf_config: BaseTerraformConfig,
                           infraenv_config: InfraEnvConfig):
            if "nodes" in nodes_data:
                return nodes_data["nodes"]

            nodes_data["configs"] = infraenv_config, tf_config

            net_asset = LibvirtNetworkAssets()
            tf_config.net_asset = net_asset.get()
            nodes_data["net_asset"] = net_asset

            controller = TerraformController(tf_config,
                                             entity_config=infraenv_config)
            nodes = Nodes(controller)
            nodes_data["nodes"] = nodes

            nodes.prepare_nodes()

            interfaces = BaseTest.nat_interfaces(tf_config)
            nat = NatController(
                interfaces, NatController.get_namespace_index(interfaces[0]))
            nat.add_nat_rules()

            nodes_data["nat"] = nat

            return nodes
Example #2
0
 def __init__(self, config: BaseTerraformConfig, entity_config: Union[BaseClusterConfig, BaseInfraEnvConfig]):
     super().__init__(config, entity_config)
     self._entity_name = self._get_entity_name()
     self._suffix = self._entity_name.suffix or get_name_suffix()
     self.tf_folder = config.tf_folder or self._create_tf_folder(self._entity_name.get(), config.platform)
     self.network_name = config.network_name + self._suffix
     self.params = self._terraform_params(**config.get_all())
     self.tf = terraform_utils.TerraformUtils(working_dir=self.tf_folder)
     self.master_ips = None
 def __init__(self, config: BaseTerraformConfig):
     super().__init__(config.private_ssh_key_path)
     self.config = config
     self.cluster_suffix = self._get_cluster_suffix(config.cluster_name)
     self.cluster_name = config.cluster_name
     self.network_name = config.network_name + self.cluster_suffix
     self.tf_folder = config.tf_folder or self._create_tf_folder(
         self.cluster_name, config.platform)
     self.params = self._terraform_params(**config.get_all())
     self.tf = terraform_utils.TerraformUtils(working_dir=self.tf_folder)
     self.master_ips = None