From 5c8a674d18bf70576fa122778d07c2463d06bd80 Mon Sep 17 00:00:00 2001 From: dharp Date: Fri, 17 Feb 2023 13:59:56 -0600 Subject: [PATCH] deploy ssh:move configuration load and validation into separate function re-factor in support of adding multiple ssh runs with different configurations --- deploy/ssh.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/deploy/ssh.sh b/deploy/ssh.sh index c66e2e19..b2e83aa8 100644 --- a/deploy/ssh.sh +++ b/deploy/ssh.sh @@ -43,6 +43,19 @@ ssh_deploy() { _debug _cca "$_cca" _debug _cfullchain "$_cfullchain" + if ! _ssh_load_config; then + return 1 + fi + + _deploy_ssh_servers="$DEPLOY_SSH_SERVER" + for DEPLOY_SSH_SERVER in $_deploy_ssh_servers; do + _ssh_deploy + done +} + +_ssh_load_config() { + _deploy_ssh_servers="" + # USER is required to login by SSH to remote host. _migratedeployconf Le_Deploy_ssh_user DEPLOY_SSH_USER _getdeployconf DEPLOY_SSH_USER @@ -169,11 +182,6 @@ ssh_deploy() { else _info "Required commands batched and sent in single call to remote host" fi - - _deploy_ssh_servers="$DEPLOY_SSH_SERVER" - for DEPLOY_SSH_SERVER in $_deploy_ssh_servers; do - _ssh_deploy - done } _ssh_deploy() {