From 91e1da9e038a945c1a30c6a4bda9083a3ae89805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 29 Jan 2020 13:10:41 +0100 Subject: [PATCH] rename ageth to ageth-{{ geth_cont_name }} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes issue on hosts where multiple instances run. Signed-off-by: Jakub SokoĊ‚owski --- tasks/wrapper.yml | 2 +- templates/geth-attach-wrapper.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tasks/wrapper.yml b/tasks/wrapper.yml index 5cfa382..732d0ab 100644 --- a/tasks/wrapper.yml +++ b/tasks/wrapper.yml @@ -2,5 +2,5 @@ - name: Create geth attach wrapper template: src: geth-attach-wrapper.sh - dest: /usr/local/bin/ageth + dest: '/usr/local/bin/ageth-{{ geth_cont_name }}' mode: 0755 diff --git a/templates/geth-attach-wrapper.sh b/templates/geth-attach-wrapper.sh index 5dcd8e4..5a6d665 100644 --- a/templates/geth-attach-wrapper.sh +++ b/templates/geth-attach-wrapper.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash + +GETH_RPC_PORT="{{ geth_rpc_port }}" +GETH_CONT_NAME="{{ geth_cont_name }}" + if [[ -z "$@" ]]; then - docker exec -it {{ geth_cont_name }} geth attach http://localhost:{{ geth_rpc_port }} + docker exec -it "${GETH_CONT_NAME}" geth attach "http://localhost:${GETH_RPC_PORT}" else - docker exec {{ geth_cont_name }} geth attach http://localhost:{{ geth_rpc_port }} --exec "$@" + docker exec "${GETH_CONT_NAME}" geth attach "http://localhost:${GETH_RPC_PORT}" --exec "$@" fi