15599: Improve error message when no role is defined.
authorTom Clegg <tclegg@veritasgenetics.com>
Mon, 30 Sep 2019 23:22:27 +0000 (19:22 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Mon, 30 Sep 2019 23:22:27 +0000 (19:22 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/keepstore/s3_volume.go

index 65950606f3f75b8aae5fc62ca673b8a07f83c0d8..e39d7b79b5eb5b1bf131c6d86105bda046298870 100644 (file)
@@ -233,7 +233,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)