4
4
import click
5
5
import yaml
6
6
7
- from .k8s import get_default_namespace
8
- from .namespaces import (
9
- BITCOIN_CHART_LOCATION as NAMESPACES_CHART_LOCATION ,
10
- )
11
- from .namespaces import (
12
- DEFAULTS_FILE as NAMESPACES_DEFAULTS_FILE ,
13
- )
14
- from .namespaces import (
15
- NAMESPACES_FILE ,
16
- )
17
- from .network import (
18
- BITCOIN_CHART_LOCATION as NETWORK_CHART_LOCATION ,
19
- )
20
- from .network import (
21
- DEFAULTS_FILE as NETWORK_DEFAULTS_FILE ,
22
- )
23
-
24
- # Import necessary functions and variables from network.py and namespaces.py
25
- from .network import (
7
+ from .constants import (
8
+ BITCOIN_CHART_LOCATION ,
9
+ DEFAULTS_FILE ,
26
10
FORK_OBSERVER_CHART ,
11
+ HELM_COMMAND ,
12
+ NAMESPACES_FILE ,
27
13
NETWORK_FILE ,
28
14
)
15
+ from .k8s import get_default_namespace
29
16
from .process import stream_command
30
17
31
- HELM_COMMAND = "helm upgrade --install --create-namespace"
32
-
33
18
34
19
def validate_directory (ctx , param , value ):
35
20
directory = Path (value )
@@ -82,7 +67,6 @@ def deploy_fork_observer(directory: Path, debug: bool):
82
67
override_string = ""
83
68
84
69
# Add an entry for each node in the graph
85
- # TODO: should this be moved into a chart, and only have substituted name and rpc_host values
86
70
for i , node in enumerate (network_file ["nodes" ]):
87
71
node_name = node .get ("name" )
88
72
node_config = f"""
@@ -97,7 +81,6 @@ def deploy_fork_observer(directory: Path, debug: bool):
97
81
"""
98
82
99
83
override_string += node_config
100
- # End loop
101
84
102
85
# Create yaml string using multi-line string format
103
86
override_string = override_string .strip ()
@@ -119,7 +102,7 @@ def deploy_fork_observer(directory: Path, debug: bool):
119
102
120
103
def deploy_network (directory : Path , debug : bool = False ):
121
104
network_file_path = directory / NETWORK_FILE
122
- defaults_file_path = directory / NETWORK_DEFAULTS_FILE
105
+ defaults_file_path = directory / DEFAULTS_FILE
123
106
124
107
with network_file_path .open () as f :
125
108
network_file = yaml .safe_load (f )
@@ -133,7 +116,7 @@ def deploy_network(directory: Path, debug: bool = False):
133
116
node_name = node .get ("name" )
134
117
node_config_override = {k : v for k , v in node .items () if k != "name" }
135
118
136
- cmd = f"{ HELM_COMMAND } { node_name } { NETWORK_CHART_LOCATION } --namespace { namespace } -f { defaults_file_path } "
119
+ cmd = f"{ HELM_COMMAND } { node_name } { BITCOIN_CHART_LOCATION } --namespace { namespace } -f { defaults_file_path } "
137
120
if debug :
138
121
cmd += " --debug"
139
122
@@ -158,7 +141,7 @@ def deploy_network(directory: Path, debug: bool = False):
158
141
159
142
def deploy_namespaces (directory : Path ):
160
143
namespaces_file_path = directory / NAMESPACES_FILE
161
- defaults_file_path = directory / NAMESPACES_DEFAULTS_FILE
144
+ defaults_file_path = directory / DEFAULTS_FILE
162
145
163
146
with namespaces_file_path .open () as f :
164
147
namespaces_file = yaml .safe_load (f )
@@ -178,7 +161,9 @@ def deploy_namespaces(directory: Path):
178
161
namespace_name = namespace .get ("name" )
179
162
namespace_config_override = {k : v for k , v in namespace .items () if k != "name" }
180
163
181
- cmd = f"{ HELM_COMMAND } { namespace_name } { NAMESPACES_CHART_LOCATION } -f { defaults_file_path } "
164
+ cmd = (
165
+ f"{ HELM_COMMAND } { namespace_name } { BITCOIN_CHART_LOCATION } -f { defaults_file_path } "
166
+ )
182
167
183
168
if namespace_config_override :
184
169
with tempfile .NamedTemporaryFile (
0 commit comments