Fixes an IAM role authentication bug

More specifically, the driver panics if initialized with
FromParameters with empty accesskey or secretkey.
This commit is contained in:
Andrey Kostov 2015-01-23 15:50:55 -08:00
parent 75c1b2bae7
commit 34f86b9ad6

View file

@ -82,8 +82,14 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) {
// Providing no values for these is valid in case the user is authenticating // Providing no values for these is valid in case the user is authenticating
// with an IAM on an ec2 instance (in which case the instance credentials will // with an IAM on an ec2 instance (in which case the instance credentials will
// be summoned when GetAuth is called) // be summoned when GetAuth is called)
accessKey, _ := parameters["accesskey"] accessKey, ok := parameters["accesskey"]
secretKey, _ := parameters["secretkey"] if !ok {
accessKey = ""
}
secretKey, ok := parameters["secretkey"]
if !ok {
secretKey = ""
}
regionName, ok := parameters["region"] regionName, ok := parameters["region"]
if !ok || fmt.Sprint(regionName) == "" { if !ok || fmt.Sprint(regionName) == "" {