Skip to content

Commit 574db4a

Browse files
committed
include: dts-subscription: move warning print outside login_to_dpp_server
login_to_dpp_server should only try to login, the decision to print warning or not should be done outside this function basing on the output of this function. Otherwise every time the function is being called the warning could be printed too, which is not always wanted. Signed-off-by: Daniil Klimuk <[email protected]>
1 parent b3a9ac8 commit 574db4a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

include/dts-functions.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,14 @@ main_menu_options(){
14641464

14651465
# Try to log in using available DPP credentials, start loop over if login
14661466
# was not successful:
1467-
login_to_dpp_server || return 0
1467+
login_to_dpp_server
1468+
if [ $? -ne 0 ]; then
1469+
print_warning "Your credentials do not have access to DPP packages. If you bought one, check the"
1470+
print_warning "credentials you have used, and contact support. If you did not buy any DPP"
1471+
print_warning "packages - feel free to continue."
1472+
read -p "Press enter to continue"
1473+
return 0
1474+
fi
14681475

14691476
# Check if there is some packages available to install, start loop over if
14701477
# no packages is available:

include/dts-subscription.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ login_to_dpp_server(){
9595
# Check if the user is already logged in, log in if not:
9696
if [ -z "$(mc alias list | grep ${CLOUDSEND_DOWNLOAD_URL})" ]; then
9797
if ! mc alias set $DPP_SERVER_USER_ALIAS $DPP_SERVER_ADDRESS $CLOUDSEND_DOWNLOAD_URL $CLOUDSEND_PASSWORD >> $ERR_LOG_FILE 2>&1 ; then
98-
print_warning "Your credentials do not have access to DPP packages. If you bought one, check the"
99-
print_warning "credentials you have used, and contact support. If you did not buy any DPP"
100-
print_warning "packages - feel free to continue."
101-
read -p "Press enter to continue"
10298
return 1
10399
fi
104100
fi

0 commit comments

Comments
 (0)