From 4797a82e1ad3424c4dfd394f3b9857fa8581aa80 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Tue, 21 Jul 2015 15:57:59 +0200 Subject: [PATCH] aws: Simplify ValidateCredentials func --- builtin/providers/aws/config.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index a1a0dd361..f58938285 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -174,16 +174,14 @@ func (c *Config) ValidateRegion() error { // Validate credentials early and fail before we do any graph walking func (c *Config) ValidateCredentials(iamconn *iam.IAM) error { _, err := iamconn.GetUser(nil) - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - if awsErr.Code() == "SignatureDoesNotMatch" { - return fmt.Errorf("Failed authenticating with AWS: please verify credentials") - } + + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "SignatureDoesNotMatch" { + return fmt.Errorf("Failed authenticating with AWS: please verify credentials") } - return err } - return nil + return err } // ValidateAccountId returns a context-specific error if the configured account