diff --git a/libs/python/helperCommandExecution.py b/libs/python/helperCommandExecution.py index 8edeef92..fc6e85ff 100644 --- a/libs/python/helperCommandExecution.py +++ b/libs/python/helperCommandExecution.py @@ -33,6 +33,8 @@ def login_cf(btpUsecase): command = "cf login -a '" + cfApiEndpoint + "' -o '" + org + "' --sso" pipe = True else: + password = escapePassword(password) + command = "cf login -a '" + cfApiEndpoint + "' -o '" + org + "' -u '" + \ myemail + "' -p '" + password + "'" runShellCommandFlex(btpUsecase, command, "INFO", "Logging-in to your CF environment in the org >" + @@ -45,8 +47,6 @@ def login_btp(btpUsecase): globalaccount = btpUsecase.globalaccount btpCliRegion = btpUsecase.btpcliapihostregion - password = escapePassword(password) - command = "btp login --url 'https://cpcli.cf." + btpCliRegion + \ ".hana.ondemand.com' --subdomain '" + globalaccount + "'" if btpUsecase.loginmethod == "sso": @@ -55,6 +55,9 @@ def login_btp(btpUsecase): runShellCommandFlex(btpUsecase, command, "INFO", message, True, True) fetchEmailAddressFromBtpConfigFile(btpUsecase) else: + + password = escapePassword(password) + message = "Logging-in to your global account with subdomain ID >" + \ str(globalaccount) + "< for your user >" + str(myemail) + "<" command = command + " --user '" + \ diff --git a/libs/python/helperRolesAndUsers.py b/libs/python/helperRolesAndUsers.py index 1dd0d9fe..2bb08c14 100644 --- a/libs/python/helperRolesAndUsers.py +++ b/libs/python/helperRolesAndUsers.py @@ -1,4 +1,5 @@ from libs.python.helperCommandExecution import runCommandAndGetJsonResult, runShellCommandFlex, runShellCommand +from libs.python.helperCommandExecution import login_cf from libs.python.helperJson import getJsonFromFile import logging @@ -264,6 +265,10 @@ def assignUsersToEnvironments(btpUsecase): if environments: for environment in environments: if environment.name == "cloudfoundry": + # Make sure that you are logged in to the CF API + if btpUsecase.skipcfspacecreation is True: + login_cf(btpUsecase) + org = btpUsecase.org cfspacename = btpUsecase.cfspacename