File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,12 @@ choose_ip_address() {
144
144
header " $prompt "
145
145
echo " $help_text "
146
146
147
+ if [ ${# ip_array[@]} -eq 0 ]; then
148
+ echo " $( red " No IP addresses found." ) "
149
+ echo " $( red " Please check your network configuration." ) "
150
+ exit 1
151
+ fi
152
+
147
153
if [ ${# ip_array[@]} -eq 1 ]; then
148
154
local chosen_ip=" ${ip_array[0]} "
149
155
echo -e " $( green " Only one IP address available:" ) $( cyan " $chosen_ip " ) \n"
@@ -156,7 +162,7 @@ choose_ip_address() {
156
162
echo " $( gray " (Enter the number of your choice)" ) "
157
163
158
164
while true ; do
159
- read -p " $( green " >" ) " choice
165
+ read -r - p " $( green " >" ) " choice
160
166
if [[ " $choice " =~ ^[0-9]+$ ]] && [ " $choice " -ge 1 ] && [ " $choice " -le " ${# ip_array[@]} " ]; then
161
167
local chosen_ip=" ${ip_array[$((choice-1))]} "
162
168
echo -e " \n$( green " You selected:" ) $( cyan " $chosen_ip " ) \n"
@@ -214,7 +220,7 @@ get_user_credentials() {
214
220
echo -e " \n$( green " Credentials saved successfully." ) "
215
221
}
216
222
217
- IP_LIST=$( /tmp/ptah-agent list-ips)
223
+ IP_LIST=" $( /tmp/ptah-agent list-ips | tr -d ' \n ' ) "
218
224
choose_ip_address " $IP_LIST " " Advertised IP addresses" " ADVERTISE_ADDR" " $ADVERTISED_IP_HELP "
219
225
choose_ip_address " $IP_LIST " " Public IP address" " PUBLIC_IP" " $PUBLIC_IP_HELP "
220
226
You can’t perform that action at this time.
0 commit comments