Add the GOGC=10 environment variable to the Keepstore service file, to make
[arvados.git] / services / keepstore / s3_volume.go
index 65950606f3f75b8aae5fc62ca673b8a07f83c0d8..220377af280f2d64c682624ee69a67cfd6f3b636 100644 (file)
@@ -160,6 +160,9 @@ func (v *S3Volume) GetDeviceID() string {
 
 func (v *S3Volume) bootstrapIAMCredentials() error {
        if v.AccessKey != "" || v.SecretKey != "" {
+               if v.IAMRole != "" {
+                       return errors.New("invalid DriverParameters: AccessKey and SecretKey must be blank if IAMRole is specified")
+               }
                return nil
        }
        ttl, err := v.updateIAMCredentials()
@@ -233,7 +236,9 @@ func (v *S3Volume) updateIAMCredentials() (time.Duration, error) {
                        return 0, fmt.Errorf("error getting %s: %s", url, err)
                }
                defer resp.Body.Close()
-               if resp.StatusCode != http.StatusOK {
+               if resp.StatusCode == http.StatusNotFound {
+                       return 0, fmt.Errorf("this instance does not have an IAM role assigned -- either assign a role, or configure AccessKey and SecretKey explicitly in DriverParameters (error getting %s: HTTP status %s)", url, resp.Status)
+               } else if resp.StatusCode != http.StatusOK {
                        return 0, fmt.Errorf("error getting %s: HTTP status %s", url, resp.Status)
                }
                body := bufio.NewReader(resp.Body)