Skip to content

Commit 4410200

Browse files
authored
Merge pull request #314 from pinheadmz/clean-subdirs
tank: remove config_dir
2 parents 43b7d4d + 1d77a86 commit 4410200

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

src/backends/compose/compose_backend.py

-10
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
default_bitcoin_conf_args,
2020
get_architecture,
2121
parse_raw_messages,
22-
set_execute_permission,
2322
)
2423

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

362-
def copy_configs(self, tank):
363-
warnet_tor_dir = tank.config_dir / "tor"
364-
warnet_tor_dir.mkdir()
365-
shutil.copyfile(TEMPLATES / DOCKERFILE_NAME, tank.config_dir / DOCKERFILE_NAME)
366-
shutil.copyfile(TEMPLATES / "tor" / TORRC_NAME, warnet_tor_dir / TORRC_NAME)
367-
shutil.copyfile(TEMPLATES / ENTRYPOINT_NAME, tank.config_dir / ENTRYPOINT_NAME)
368-
set_execute_permission(tank.config_dir / ENTRYPOINT_NAME)
369-
370361
def add_services(self, tank: Tank, compose):
371362
services = compose["services"]
372363
assert tank.index is not None
@@ -386,7 +377,6 @@ def add_services(self, tank: Tank, compose):
386377
tank.DEFAULT_BUILD_ARGS + tank.build_args,
387378
arches=get_architecture(),
388379
)
389-
self.copy_configs(tank)
390380
elif tank.image:
391381
# Pre-built custom image
392382
image = tank.image

src/warnet/tank.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
import logging
6-
from pathlib import Path
76

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

27-
def __init__(self, index: int, config_dir: Path, warnet):
26+
def __init__(self, index: int, warnet):
2827
self.index = index
29-
self.config_dir = config_dir
3028
self.warnet = warnet
3129
self.network_name = warnet.network_name
3230
self.bitcoin_network = warnet.bitcoin_network
@@ -84,9 +82,6 @@ def parse_graph_node(self, node):
8482
self.warnet, self, impl, image, self.warnet.container_interface, cb_image
8583
)
8684

87-
self.config_dir = self.warnet.config_dir / str(self.suffix)
88-
self.config_dir.mkdir(parents=True, exist_ok=True)
89-
9085
logger.debug(
9186
f"Parsed graph node: {self.index} with attributes: {[f'{key}={value}' for key, value in graph_properties.items()]}"
9287
)
@@ -95,11 +90,9 @@ def parse_graph_node(self, node):
9590
def from_graph_node(cls, index, warnet, tank=None):
9691
assert index is not None
9792
index = int(index)
98-
config_dir = warnet.config_dir / str(f"{index:06}")
99-
config_dir.mkdir(parents=True, exist_ok=True)
10093
self = tank
10194
if self is None:
102-
self = cls(index, config_dir, warnet)
95+
self = cls(index, warnet)
10396
node = warnet.graph.nodes[index]
10497
self.parse_graph_node(node)
10598
return self

0 commit comments

Comments
 (0)