Skip to content

Commit

Permalink
Fix org and space auth
Browse files Browse the repository at this point in the history
  • Loading branch information
jriguera committed Sep 15, 2020
1 parent f7b5793 commit cb78de5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docker/snpaas-tools/resources/manage-cf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ cf_system_check() {
cfenv() {
local target=""
local rvalue=0
local org="${CF_ORG:-system}"
local space="${CF_SPACE:-system}"

if ! ${CF_CLI} oauth-token > /dev/null 2>&1
then
if [ -n "${CF_USER}" ] && [ -n "${CF_PASSWORD}" ] && [ -n "${CF_API}" ]
then
${CF_CLI} logout > /dev/null 2>&1
if ! ${CF_CLI} login -a "${CF_API}" -u "${CF_USER}" -p "${CF_PASSWORD}" -o "system" -s "system" > /dev/null 2>&1
if ! ${CF_CLI} login -a "${CF_API}" -u "${CF_USER}" -p "${CF_PASSWORD}" -o "${org}" -s "${space}" > /dev/null 2>&1
then
echo_log "ERROR" "Cannot login in CF with the provided environment variables"
return 1
Expand Down Expand Up @@ -128,13 +130,15 @@ cfrun() {
cfexec() {
local target=""
local rvalue=0
local org="${CF_ORG:-system}"
local space="${CF_SPACE:-system}"

if ! ${CF_CLI} oauth-token > /dev/null 2>&1
then
if [ -n "${CF_USER}" ] && [ -n "${CF_PASSWORD}" ] && [ -n "${CF_API}" ]
then
${CF_CLI} logout > /dev/null 2>&1
if ! ${CF_CLI} login -a "${CF_API}" -u "${CF_USER}" -p "${CF_PASSWORD}" -o "system" -s "system" > /dev/null 2>&1
if ! ${CF_CLI} login -a "${CF_API}" -u "${CF_USER}" -p "${CF_PASSWORD}" -o "${org}" -s "${space}" > /dev/null 2>&1
then
echo_log "ERROR" "Cannot login in CF with the provided environment variables"
return 1
Expand Down

0 comments on commit cb78de5

Please sign in to comment.