Skip to content

Commit

Permalink
Merge pull request #818 from serokell/krendelhoff/#759-gracefully-han…
Browse files Browse the repository at this point in the history
…dle-testnet-unavailability

[#759] Handle testnet config unavailability
  • Loading branch information
krendelhoff2 authored Aug 26, 2024
2 parents 86bdd6f + d913217 commit 457d522
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions docker/package/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ def mk_node_unit(
node_units = []
node_postinst_steps = postinst_steps_common
node_additional_scripts = []
node_postinst_steps += """
curl -sSL https://teztnets.com/teztnets.json -o /var/lib/tezos/teztnets.json
"""
for network, network_config in networks.items():
config_file_append = [
f'TEZOS_NODE_DIR="/var/lib/tezos/node-{network}"',
Expand All @@ -273,9 +276,15 @@ def mk_node_unit(
)
)
node_postinst_steps += f"""
mkdir -p /var/lib/tezos/node-{network}
[ ! -f /var/lib/tezos/node-{network}/config.json ] && octez-node config init --data-dir /var/lib/tezos/node-{network} --network {network_config}
chown -R tezos:tezos /var/lib/tezos/node-{network}
config="$(cat /var/lib/tezos/teztnets.json | jq .{network})"
if [ "$config" != "null" ]; then
mkdir -p /var/lib/tezos/node-{network}
[ ! -f /var/lib/tezos/node-{network}/config.json ] && octez-node config init --data-dir /var/lib/tezos/node-{network} --network {network_config}
chown -R tezos:tezos /var/lib/tezos/node-{network}
else
echo "Network {network} not found in teztnets.json"
echo "Skipping node setup for {network}..."
fi
"""

# Add custom config service
Expand Down Expand Up @@ -317,6 +326,7 @@ def mk_node_unit(
additional_native_deps=[
"tezos-sapling-params",
"curl",
"jq",
{"ubuntu": "netbase"},
],
additional_scripts=node_additional_scripts,
Expand Down
2 changes: 1 addition & 1 deletion tests/systemd/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2004"
config.vm.provision "shell", run: "once", inline: <<-SHELL
add-apt-repository -y ppa:serokell/tezos && apt-get update
apt-get install -y tezos-sapling-params acl python3-pystemd python3-pytest python3-psutil
apt-get install -y tezos-sapling-params acl python3-pystemd python3-pytest python3-psutil jq
SHELL
config.vm.provision "file", run: "always", source: "#{packagesDirectory}", destination: "$HOME/out"
config.vm.provision "file", run: "always", source: "services_tests.py", destination: "$HOME/services_tests.py"
Expand Down

0 comments on commit 457d522

Please sign in to comment.