Remove test code, lint fixes

This commit is contained in:
David Boreham 2024-07-30 07:29:49 -06:00
parent adb012f51f
commit ad64ad8720
3 changed files with 4 additions and 20 deletions

View File

@ -22,7 +22,6 @@ from stack_orchestrator.opts import opts
from enum import Enum from enum import Enum
from pathlib import Path from pathlib import Path
from shutil import copyfile, copytree from shutil import copyfile, copytree
import json
import os import os
import sys import sys
import tomli import tomli
@ -62,26 +61,12 @@ def _get_node_moniker_from_config(network_dir: Path):
return moniker return moniker
def _get_node_key_from_gentx(gentx_file_name: str):
gentx_file_path = Path(gentx_file_name)
if gentx_file_path.exists():
with open(Path(gentx_file_name), "rb") as f:
parsed_json = json.load(f)
print(f"parsed_json: {parsed_json}")
return parsed_json['body']['messages'][0]['validator_address']
else:
print(f"Error: gentx file: {gentx_file_name} does not exist")
sys.exit(1)
def _comma_delimited_to_list(list_str: str): def _comma_delimited_to_list(list_str: str):
return list_str.split(",") if list_str else [] return list_str.split(",") if list_str else []
def _get_node_keys_from_gentx_files(gentx_address_list: str): def _get_node_keys_from_gentx_files(gentx_address_list: str):
node_keys = []
gentx_addresses = _comma_delimited_to_list(gentx_address_list) gentx_addresses = _comma_delimited_to_list(gentx_address_list)
print(f"gentx_files: {gentx_addresses}")
return gentx_addresses return gentx_addresses
@ -263,10 +248,10 @@ def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCo
# First look in the supplied gentx files for the other nodes' keys # First look in the supplied gentx files for the other nodes' keys
other_node_keys = _get_node_keys_from_gentx_files(parameters.gentx_address_list) other_node_keys = _get_node_keys_from_gentx_files(parameters.gentx_address_list)
# Add those keys to our genesis, with balances we determine here (why?) # Add those keys to our genesis, with balances we determine here (why?)
print(f"other_node_keys: {other_node_keys}")
for other_node_key in other_node_keys: for other_node_key in other_node_keys:
outputk, statusk = run_container_command( outputk, statusk = run_container_command(
command_context, "laconicd", f"laconicd genesis add-genesis-account {other_node_key} 12900000000000000000000{currency}\ command_context, "laconicd", f"laconicd genesis add-genesis-account {other_node_key} \
12900000000000000000000{currency}\
--home {laconicd_home_path_in_container} --keyring-backend test", mounts) --home {laconicd_home_path_in_container} --keyring-backend test", mounts)
if options.debug: if options.debug:
print(f"Command output: {outputk}") print(f"Command output: {outputk}")

View File

@ -13,7 +13,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>. # along with this program. If not, see <http:#www.gnu.org/licenses/>.
import os
from typing import List, Any from typing import List, Any
from stack_orchestrator.deploy.deploy_types import DeployCommandContext, VolumeMapping from stack_orchestrator.deploy.deploy_types import DeployCommandContext, VolumeMapping
from stack_orchestrator.util import get_parsed_stack_config, get_yaml, get_pod_list, resolve_compose_file from stack_orchestrator.util import get_parsed_stack_config, get_yaml, get_pod_list, resolve_compose_file

View File

@ -543,8 +543,8 @@ def create_operation(deployment_command_context, spec_file, deployment_dir, netw
@click.option("--network-dir", help="Directory for network files") @click.option("--network-dir", help="Directory for network files")
@click.argument('extra_args', nargs=-1) @click.argument('extra_args', nargs=-1)
@click.pass_context @click.pass_context
def setup(ctx, node_moniker, chain_id, key_name, gentx_files, gentx_addresses, genesis_file, initialize_network, join_network, create_network, def setup(ctx, node_moniker, chain_id, key_name, gentx_files, gentx_addresses, genesis_file, initialize_network, join_network,
network_dir, extra_args): create_network, network_dir, extra_args):
parmeters = LaconicStackSetupCommand(chain_id, node_moniker, key_name, initialize_network, join_network, create_network, parmeters = LaconicStackSetupCommand(chain_id, node_moniker, key_name, initialize_network, join_network, create_network,
gentx_files, gentx_addresses, genesis_file, network_dir) gentx_files, gentx_addresses, genesis_file, network_dir)
call_stack_deploy_setup(ctx.obj, parmeters, extra_args) call_stack_deploy_setup(ctx.obj, parmeters, extra_args)