Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vpc config checks #173

Merged
merged 1 commit into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ script:
- cd $GOPATH/src/github.com/IBM/ibmcloud-storage-volume-lib
- source secret.txt
- sed -i "s/"It\(\"VPC"/"PIt\(\"VPC"/g" $GOPATH/src/github.com/IBM/ibmcloud-storage-volume-lib/e2e/vpc/vpc_create_six_volumes_attach_detach_delete_volumes.go
- sed -i "s/"It\(\"VPC"/"PIt\(\"VPC"/g" $GOPATH/src/github.com/IBM/ibmcloud-storage-volume-lib/e2e/vpc/vpc_create_volume_attach_detach_volume.go
- sed -i "s/RIAAS_ENDPOINT_URL/"$RIAAS_ENDPOINT_URL"/g" $GOPATH/src/github.com/IBM/ibmcloud-storage-volume-lib/e2e/config/vpc-config.toml
- sed -i "s/RESOURCE_GROUP/"$RESOURCE_GROUP"/g" $GOPATH/src/github.com/IBM/ibmcloud-storage-volume-lib/e2e/config/vpc-config.toml
- sed -i "s/IAM_API_KEY/"$IAM_API_KEY"/g" $GOPATH/src/github.com/IBM/ibmcloud-storage-volume-lib/e2e/config/vpc-config.toml
Expand Down
7 changes: 3 additions & 4 deletions provider/utils/init_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,20 @@ func GenerateContextCredentials(conf *config.Config, providerID string, contextC
slUser := conf.Softlayer.SoftlayerUsername
slAPIKey := conf.Softlayer.SoftlayerAPIKey
iamAPIKey := conf.Bluemix.IamAPIKey
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Bluemix also be nil?

vpcIamAPIKey := conf.VPC.APIKey

// Select appropriate authentication strategy
isSLProvider := providerID == conf.Softlayer.SoftlayerBlockProviderName || providerID == conf.Softlayer.SoftlayerFileProviderName
switch {
case isSLProvider && !isEmptyStringValue(&slUser) && !isEmptyStringValue(&slAPIKey):
return contextCredentialsFactory.ForIaaSAPIKey(util.SafeStringValue(&AccountID), slUser, slAPIKey, ctxLogger)

case (providerID == conf.VPC.VPCBlockProviderName):
return contextCredentialsFactory.ForIAMAccessToken(vpcIamAPIKey, ctxLogger)
case (conf.VPC != nil && providerID == conf.VPC.VPCBlockProviderName):
return contextCredentialsFactory.ForIAMAccessToken(conf.VPC.APIKey, ctxLogger)

case isSLProvider && !isEmptyStringValue(&iamAPIKey):
return contextCredentialsFactory.ForIAMAPIKey(AccountID, iamAPIKey, ctxLogger)

case (providerID == conf.IKS.IKSBlockProviderName):
case (conf.IKS != nil && providerID == conf.IKS.IKSBlockProviderName):
return provider.ContextCredentials{}, nil // Get credentials in OpenSession method

default:
Expand Down