Skip to content

Commit 3e05c58

Browse files
committed
allow a namespace parameter in deploy
Allowing a namespace parameter in deploy means that we can easily launch tanks into a given namespace, and we can safely ignore this parameter in other functions because it defaults to None which the code will handle gracefully.
1 parent c31fb18 commit 3e05c58

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/warnet/deploy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
import tempfile
44
from pathlib import Path
5+
from typing import Optional
56

67
import click
78
import yaml
@@ -189,14 +190,15 @@ def deploy_fork_observer(directory: Path, debug: bool) -> bool:
189190
return True
190191

191192

192-
def deploy_network(directory: Path, debug: bool = False):
193+
def deploy_network(directory: Path, debug: bool = False, namespace: Optional[str] = None):
193194
network_file_path = directory / NETWORK_FILE
194195
defaults_file_path = directory / DEFAULTS_FILE
195196

196197
with network_file_path.open() as f:
197198
network_file = yaml.safe_load(f)
198199

199-
namespace = get_default_namespace()
200+
if not namespace:
201+
namespace = get_default_namespace()
200202

201203
for node in network_file["nodes"]:
202204
click.echo(f"Deploying node: {node.get('name')}")

0 commit comments

Comments
 (0)