Fixed a couple of bugs in the TUI like not properly fetching the size of the vpc_arr, or removing the prefix/suffix markers for Ansible's blockinfile from the SSH key

This commit is contained in:
hamilcarBarca17
2023-08-03 10:51:34 -06:00
parent 033155f3e2
commit 7dda9b962d
2 changed files with 17 additions and 10 deletions
+7
View File
@@ -21,6 +21,13 @@
blockinfile: blockinfile:
path: "{{ ansible_env.HOME }}/.ssh/{{ ssh_key_name }}.pem" path: "{{ ansible_env.HOME }}/.ssh/{{ ssh_key_name }}.pem"
block: "{{ aws_key_pair.key.private_key }}" block: "{{ aws_key_pair.key.private_key }}"
marker: ""
- name: Remove the blank lines from blockinfile module
lineinfile:
path: "{{ ansible_env.HOME }}/.ssh/{{ ssh_key_name }}.pem"
state: absent
regexp: '^$'
when: when:
- "'destroy' not in ansible_run_tags" - "'destroy' not in ansible_run_tags"
+10 -10
View File
@@ -62,6 +62,16 @@ initialize-environment() {
main-menu main-menu
} }
prompt-for-vpc-id() {
readarray -t vpc_arr < <(aws ec2 describe-vpcs | jq -r '.Vpcs[] | "\(.VpcId) \((.Tags[]? | select(.Key | contains("Name")) | .Value) // "")"' | awk '{print($1, $2 == "" ? "-" : $2);}')
declare prompt=""
for item in "${vpc_arr[@]}"; do
prompt+="$item OFF "
done
VPC_ID=$(whiptail --fb --title "Select VPC" --radiolist "Select which VPC to use to deploy resources into" "$BOX_HEIGHT" "$BOX_WIDTH" "${#vpc_arr[@]}" $prompt 3>&2 2>&1 1>&3)
}
deploy-and-run-benchmarkers() { deploy-and-run-benchmarkers() {
declare title="Deploy and Run Benchmarkers" declare title="Deploy and Run Benchmarkers"
@@ -213,16 +223,6 @@ custom-selections() {
main-menu main-menu
} }
prompt-for-vpc-id() {
readarray -t vpc_arr < <(aws ec2 describe-vpcs | jq -r '.Vpcs[] | "\(.VpcId) \((.Tags[]? | select(.Key | contains("Name")) | .Value) // "")"' | awk '{print($1, $2 == "" ? "-" : $2);}')
declare prompt=""
for item in "${vpc_arr[@]}"; do
prompt+="$item OFF "
done
VPC_ID=$(whiptail --fb --title "Select VPC" --radiolist "Select which VPC to use to deploy resources into" "$BOX_HEIGHT" "$BOX_WIDTH" "${vpc_arr[@]}" $prompt 3>&2 2>&1 1>&3)
}
main-menu() { main-menu() {
declare choice declare choice
choice=$(whiptail --fb --title "DynamoDB + DAX Benchmarker" --menu "Select an action" "$BOX_HEIGHT" "$BOX_WIDTH" 7 \ choice=$(whiptail --fb --title "DynamoDB + DAX Benchmarker" --menu "Select an action" "$BOX_HEIGHT" "$BOX_WIDTH" 7 \