[pkg-go] Bug#818417: prometheus: FTBFS: aws.Config does not implement client.ConfigProvider

Filippo Giunchedi filippo at debian.org
Fri Mar 25 10:46:27 UTC 2016


tags 818417 + patch
thanks

On Wed, Mar 16, 2016 at 03:19:08PM -0700, Martin Michlmayr wrote:
> > # github.com/prometheus/prometheus/retrieval/discovery
> > src/github.com/prometheus/prometheus/retrieval/discovery/ec2.go:58: undefined: defaults.DefaultChainCredentials
> > src/github.com/prometheus/prometheus/retrieval/discovery/ec2.go:107: cannot use ed.aws (type *aws.Config) as type client.ConfigProvider in argument to ec2.New:
> > 	*aws.Config does not implement client.ConfigProvider (missing ClientConfig method)

that should be related to golang-github-aws-aws-sdk-go latest upload, the
following patch fixes the FTBFS for me

diff --git a/retrieval/discovery/ec2.go b/retrieval/discovery/ec2.go
index 46b3d37..ebfd1b1 100644
--- a/retrieval/discovery/ec2.go
+++ b/retrieval/discovery/ec2.go
@@ -20,7 +20,7 @@ import (
 
        "github.com/aws/aws-sdk-go/aws"
        "github.com/aws/aws-sdk-go/aws/credentials"
-       "github.com/aws/aws-sdk-go/aws/defaults"
+       "github.com/aws/aws-sdk-go/aws/session"
        "github.com/prometheus/common/log"
        "github.com/prometheus/common/model"
 
@@ -55,7 +55,7 @@ type EC2Discovery struct {
 func NewEC2Discovery(conf *config.EC2SDConfig) *EC2Discovery {
        creds := credentials.NewStaticCredentials(conf.AccessKey, conf.SecretKey, "")
        if conf.AccessKey == "" && conf.SecretKey == "" {
-               creds = defaults.DefaultChainCredentials
+               creds = credentials.NewEnvCredentials()
        }
        return &EC2Discovery{
                aws: &aws.Config{
@@ -104,7 +104,7 @@ func (ed *EC2Discovery) Sources() []string {
 }
 
 func (ed *EC2Discovery) refresh() (*config.TargetGroup, error) {
-       ec2s := ec2.New(ed.aws)
+       ec2s := ec2.New(session.New(), ed.aws)
        tg := &config.TargetGroup{
                Source: *ed.aws.Region,
        }

filippo
-- 
http://esaurito.net - 0x99D49B6B00CAD1E5 - ⠠⠵



More information about the Pkg-go-maintainers mailing list