From 47748ef4b6b1797793416d3e1f8b274d8e0a128f Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Wed, 2 Jul 2014 14:38:23 -0700 Subject: [PATCH] metadata-service: remove check for OpenStack meta_data.json The meta_data.json blob under OpenStack doesn't actually contain all of the metadata... Fall back to explicitly requesting each attribute. --- datasource/metadata_service.go | 7 ------- datasource/metadata_service_test.go | 6 ------ 2 files changed, 13 deletions(-) diff --git a/datasource/metadata_service.go b/datasource/metadata_service.go index 3d9f993..341f743 100644 --- a/datasource/metadata_service.go +++ b/datasource/metadata_service.go @@ -27,7 +27,6 @@ const ( Ec2MetadataUrl = BaseUrl + Ec2ApiVersion + "/meta-data" OpenstackApiVersion = "openstack/2012-08-10" OpenstackUserdataUrl = BaseUrl + OpenstackApiVersion + "/user_data" - OpenstackMetadataUrl = BaseUrl + OpenstackApiVersion + "/meta_data.json" ) type metadataService struct{} @@ -80,12 +79,6 @@ func (ms *metadataService) Type() string { } func fetchMetadata(client getter) ([]byte, error) { - if metadata, err := client.GetRetry(OpenstackMetadataUrl); err == nil { - return metadata, nil - } else if _, ok := err.(pkg.ErrTimeout); ok { - return nil, err - } - attrs := make(map[string]interface{}) if keynames, err := fetchAttributes(client, fmt.Sprintf("%s/public-keys", Ec2MetadataUrl)); err == nil { keyIDs := make(map[string]string) diff --git a/datasource/metadata_service_test.go b/datasource/metadata_service_test.go index e2aa4e3..3d18533 100644 --- a/datasource/metadata_service_test.go +++ b/datasource/metadata_service_test.go @@ -145,12 +145,6 @@ func TestFetchMetadata(t *testing.T) { }, expect: []byte(`{"hostname":"host","network_config":{"content_path":"path"},"public_keys":{"test1":"key"}}`), }, - { - metadata: map[string]string{ - "http://169.254.169.254/openstack/2012-08-10/meta_data.json": "test", - }, - expect: []byte("test"), - }, {err: pkg.ErrTimeout{fmt.Errorf("test error")}}, } { client := &TestHttpClient{tt.metadata, tt.err}