Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tank: remove config_dir #314

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/backends/compose/compose_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
default_bitcoin_conf_args,
get_architecture,
parse_raw_messages,
set_execute_permission,
)

from .services import SERVICES
Expand Down Expand Up @@ -359,14 +358,6 @@ def default_config_args(self, tank):
defaults += f" -addnode={self.get_container_name(dst_index, ServiceType.BITCOIN)}"
return defaults

def copy_configs(self, tank):
warnet_tor_dir = tank.config_dir / "tor"
warnet_tor_dir.mkdir()
shutil.copyfile(TEMPLATES / DOCKERFILE_NAME, tank.config_dir / DOCKERFILE_NAME)
shutil.copyfile(TEMPLATES / "tor" / TORRC_NAME, warnet_tor_dir / TORRC_NAME)
shutil.copyfile(TEMPLATES / ENTRYPOINT_NAME, tank.config_dir / ENTRYPOINT_NAME)
set_execute_permission(tank.config_dir / ENTRYPOINT_NAME)

def add_services(self, tank: Tank, compose):
services = compose["services"]
assert tank.index is not None
Expand All @@ -386,7 +377,6 @@ def add_services(self, tank: Tank, compose):
tank.DEFAULT_BUILD_ARGS + tank.build_args,
arches=get_architecture(),
)
self.copy_configs(tank)
elif tank.image:
# Pre-built custom image
image = tank.image
Expand Down
11 changes: 2 additions & 9 deletions src/warnet/tank.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import logging
from pathlib import Path

from backends import ServiceType
from warnet.lnnode import LNNode
Expand All @@ -24,9 +23,8 @@
class Tank:
DEFAULT_BUILD_ARGS = "--disable-tests --with-incompatible-bdb --without-gui --disable-bench --disable-fuzz-binary --enable-suppress-external-warnings --enable-debug "

def __init__(self, index: int, config_dir: Path, warnet):
def __init__(self, index: int, warnet):
self.index = index
self.config_dir = config_dir
self.warnet = warnet
self.network_name = warnet.network_name
self.bitcoin_network = warnet.bitcoin_network
Expand Down Expand Up @@ -84,9 +82,6 @@ def parse_graph_node(self, node):
self.warnet, self, impl, image, self.warnet.container_interface, cb_image
)

self.config_dir = self.warnet.config_dir / str(self.suffix)
self.config_dir.mkdir(parents=True, exist_ok=True)

logger.debug(
f"Parsed graph node: {self.index} with attributes: {[f'{key}={value}' for key, value in graph_properties.items()]}"
)
Expand All @@ -95,11 +90,9 @@ def parse_graph_node(self, node):
def from_graph_node(cls, index, warnet, tank=None):
assert index is not None
index = int(index)
config_dir = warnet.config_dir / str(f"{index:06}")
config_dir.mkdir(parents=True, exist_ok=True)
self = tank
if self is None:
self = cls(index, config_dir, warnet)
self = cls(index, warnet)
node = warnet.graph.nodes[index]
self.parse_graph_node(node)
return self
Expand Down
Loading