Skip to content

Commit

Permalink
add autoapprove to ask engine_state_api
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Fehrs committed Apr 22, 2024
1 parent cbb5b58 commit dfd0a3c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions node-runner-cli/setup/BaseSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def ask_keydetails(ks_password=None, new_keystore=False, ks_file=None):
return keydetails

@staticmethod
def ask_engine_state_api():
return Prompts.ask_engine_state_api()
def ask_engine_state_api(auto_approve: bool):
return Prompts.ask_engine_state_api(auto_approve)

@staticmethod
def setup_node_optimisation_config(
Expand Down
2 changes: 1 addition & 1 deletion node-runner-cli/setup/DockerSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def questionary(argument_object: DockerConfigArguments) -> DockerConfig:
else:
del docker_config.gateway

docker_config.core_node.engine_state_enabled = BaseSetup.ask_engine_state_api()
docker_config.core_node.engine_state_enabled = BaseSetup.ask_engine_state_api(argument_object.autoapprove)

if (
"MIGRATION" in argument_object.setupmode.mode
Expand Down
2 changes: 1 addition & 1 deletion node-runner-cli/setup/SystemDSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def ask_core_node(argument_object: SystemDConfigArguments) -> CoreSystemdConfig:
systemd_config.core_node.keydetails = BaseSetup.ask_keydetails(
argument_object.keystore_password, argument_object.new_keystore
)
systemd_config.core_node.engine_state_enabled = BaseSetup.ask_engine_state_api()
systemd_config.core_node.engine_state_enabled = BaseSetup.ask_engine_state_api(argument_object.auto_approve)
return systemd_config.core_node

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ curl -X POST -k -u "gateway:${NGINX_GATEWAY_PASSWORD}" https://localhost/status/
echo "Metrics endpoint"
curl -k -f -u "metrics:${NGINX_METRICS_PASSWORD}" https://localhost/gateway/metrics

echo "Test engine state api"
curl -v -k -u "admin:${NGINX_ADMIN_PASSWORD}" -X POST --header "Content-Type: application/json" https://localhost:443/engine-state/entity/info --data '{"entity_address": "account_rdx12y386tpv29ndwslkf4drm9d5tsn6eulxg2uuxjq5ykhanuudcs7827"}'

# Endpoint does not exist
#curl -k --user "gateway:${NGINX_GATEWAY_PASSWORD}" https://localhost/token/native --header 'Content-Type: application/json' -d '{ "network_identifier":{"network":"${NETWORK_NAME}"}}'

Expand Down
3 changes: 3 additions & 0 deletions node-runner-cli/tests/userflows/install-systemd-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ NGINX_ADMIN_PASSWORD=${NGINX_ADMIN_PASSWORD} ./babylonnode api system peers
echo "Testing Core node identity"
NGINX_ADMIN_PASSWORD=${NGINX_ADMIN_PASSWORD} ./babylonnode api system identity

echo "Test engine state api"
curl -v -k -u "admin:${NGINX_ADMIN_PASSWORD}" -X POST --header "Content-Type: application/json" https://localhost:443/engine-state/entity/info --data '{"entity_address": "account_rdx12y386tpv29ndwslkf4drm9d5tsn6eulxg2uuxjq5ykhanuudcs7827"}'

echo "Restarting systemd service"
./babylonnode systemd restart

Expand Down
4 changes: 3 additions & 1 deletion node-runner-cli/utils/Prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ def ask_keyfile_name() -> str:
return keyfile_name

@staticmethod
def ask_engine_state_api() -> str:
def ask_engine_state_api(auto_approve: bool) -> str:
if auto_approve:
return 'true'
answer = Helpers.input_guestion(
"Do you want to enable the engine state api? (Y/N) (default: false):",
QuestionKeys.enable_engine_state_api
Expand Down

0 comments on commit dfd0a3c

Please sign in to comment.