Skip to content

Commit

Permalink
use default namespace when checking network connections
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Sep 13, 2024
1 parent efbb59f commit afda17c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/warnet/bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from test_framework.messages import ser_uint256
from test_framework.p2p import MESSAGEMAP

from .k8s import get_mission
from .k8s import get_default_namespace, get_mission
from .process import run_command


Expand Down Expand Up @@ -38,10 +38,11 @@ def rpc(tank: str, method: str, params: str):
def _rpc(tank: str, method: str, params: str):
# bitcoin-cli should be able to read bitcoin.conf inside the container
# so no extra args like port, chain, username or password are needed
namespace = get_default_namespace()
if params:
cmd = f"kubectl exec {tank} -- bitcoin-cli {method} {' '.join(map(str, params))}"
cmd = f"kubectl -n {namespace} exec {tank} -- bitcoin-cli {method} {' '.join(map(str, params))}"
else:
cmd = f"kubectl exec {tank} -- bitcoin-cli {method}"
cmd = f"kubectl -n {namespace} exec {tank} -- bitcoin-cli {method}"
return run_command(cmd)


Expand Down

0 comments on commit afda17c

Please sign in to comment.