From 2e45f55db0f421648a5ecb966035a6c49ea03bcd Mon Sep 17 00:00:00 2001 From: hiroTochigi Date: Wed, 2 Oct 2024 22:38:56 -0500 Subject: [PATCH] Source `detectIncompleteState.sh` in `load.sh` for barrel export. Remove leftover residue from the merge conflict resolution. Assign `keyName` to `importedKeyName` to prevent an empty key name in the treehouses config. --- src/aws/load.sh | 1 + src/aws/up.sh | 35 ++++++++++++++++------------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/aws/load.sh b/src/aws/load.sh index 85375ed9..2d6784e1 100644 --- a/src/aws/load.sh +++ b/src/aws/load.sh @@ -12,6 +12,7 @@ source $manageConfigPath/src/aws/dependencies/sshtunnelFunction.sh source $manageConfigPath/src/aws/dependencies/reverseShell.sh source $manageConfigPath/src/aws/dependencies/updateOrAppend.sh source $manageConfigPath/src/aws/dependencies/getProcessNumber.sh +source $manageConfigPath/src/aws/dependencies/detectIncompleteState.sh source $manageConfigPath/src/utils/dependencies/config.sh source $manageConfigPath/src/utils/dependencies/array.sh diff --git a/src/aws/up.sh b/src/aws/up.sh index 5cc96640..8b5e3966 100644 --- a/src/aws/up.sh +++ b/src/aws/up.sh @@ -158,6 +158,7 @@ function up { echo "Success to add ssh key: $importedKeyName" else echo "The key pair $keyname already exists. Please use another key name." + importedKeyName=$keyname fi if ! checkSecurityGroup; then @@ -197,25 +198,21 @@ function up { exit 1 fi echo "Success to add ssh key: $importedKeyName" - else - echo "The key pair $keyname already exists. Please use another key name." - importedKeyName=$keyname fi - case "$instanceState" in - "running") - echo "EC2 instance is already running." - ;; - "stopped") - echo "Starting stopped EC2 instance..." - start $instanceName - ;; - "terminated") - createAndTagInstance - ;; - *) - echo "EC2 instance is in state: $instanceState." - ;; - esac - fi + case "$instanceState" in + "running") + echo "EC2 instance is already running." + ;; + "stopped") + echo "Starting stopped EC2 instance..." + start $instanceName + ;; + "terminated") + createAndTagInstance + ;; + *) + echo "EC2 instance is in state: $instanceState." + ;; + esac }