Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

vendor update to newer infrakit version #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions plugin/metadata/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/docker/infrakit.gcp/plugin/gcloud"
metadata_plugin "github.com/docker/infrakit/pkg/plugin/metadata"
"github.com/docker/infrakit/pkg/spi/metadata"
"github.com/docker/infrakit/pkg/types"
)
Expand Down Expand Up @@ -55,7 +54,7 @@ func (p *plugin) buildTopics() map[string]interface{} {
}

func (p *plugin) addTopic(topics map[string]interface{}, path string, getter func() (string, error)) {
metadata_plugin.Put(metadata_plugin.Path(path), func() interface{} {
types.Put(types.PathFromString(path), func() interface{} {
value, err := getter()
if err != nil {
return nil // TODO
Expand All @@ -66,14 +65,14 @@ func (p *plugin) addTopic(topics map[string]interface{}, path string, getter fun

// List returns a list of *child nodes* given a path, which is specified as a slice
// where for i > j path[i] is the parent of path[j]
func (p *plugin) List(topic metadata.Path) ([]string, error) {
func (p *plugin) List(topic types.Path) ([]string, error) {
p.loadTopics()

return types.List(topic, p.topics), nil
}

// Get retrieves the value at path given.
func (p *plugin) Get(topic metadata.Path) (*types.Any, error) {
func (p *plugin) Get(topic types.Path) (*types.Any, error) {
p.loadTopics()

return types.GetValue(topic, p.topics)
Expand Down
27 changes: 14 additions & 13 deletions plugin/metadata/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
mock_gcloud "github.com/docker/infrakit.gcp/mock/gcloud"
"github.com/docker/infrakit.gcp/plugin/gcloud"
"github.com/docker/infrakit/pkg/spi/metadata"
"github.com/docker/infrakit/pkg/types"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
)
Expand All @@ -26,7 +27,7 @@ func TestList(t *testing.T) {
api, apiMetadata, _ := NewMockAPI(t)

plugin := NewPlugin(api, apiMetadata)
children, err := plugin.List(metadata.Path([]string{""}))
children, err := plugin.List(types.Path([]string{""}))

require.EqualValues(t, []string{"instance", "project", "zone"}, children)
require.NoError(t, err)
Expand All @@ -36,7 +37,7 @@ func TestListInstance(t *testing.T) {
api, apiMetadata, _ := NewMockAPI(t)

plugin := NewPlugin(api, apiMetadata)
children, err := plugin.List(metadata.Path([]string{"instance"}))
children, err := plugin.List(types.Path([]string{"instance"}))

require.EqualValues(t, []string{"ID", "externalIP", "hostname", "internalIP", "name", "network", "numericalProjectID", "projectID", "zone"}, children)
require.NoError(t, err)
Expand All @@ -47,7 +48,7 @@ func TestGetProject(t *testing.T) {
api.EXPECT().GetProject().Return("PROJECT")

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"project"}))
value, err := plugin.Get(types.Path([]string{"project"}))

require.EqualValues(t, `"PROJECT"`, value.String())
require.NoError(t, err)
Expand All @@ -58,7 +59,7 @@ func TestGetZone(t *testing.T) {
api.EXPECT().GetZone().Return("ZONE")

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"zone"}))
value, err := plugin.Get(types.Path([]string{"zone"}))

require.EqualValues(t, `"ZONE"`, value.String())
require.NoError(t, err)
Expand All @@ -69,7 +70,7 @@ func TestGetInstanceProjectID(t *testing.T) {
apiMetadata.EXPECT().ProjectID().Return("PROJECT_ID", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "projectID"}))
value, err := plugin.Get(types.Path([]string{"instance", "projectID"}))

require.EqualValues(t, `"PROJECT_ID"`, value.String())
require.NoError(t, err)
Expand All @@ -80,7 +81,7 @@ func TestGetInstanceNumericProjectID(t *testing.T) {
apiMetadata.EXPECT().NumericProjectID().Return("421337", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "numericalProjectID"}))
value, err := plugin.Get(types.Path([]string{"instance", "numericalProjectID"}))

require.EqualValues(t, `"421337"`, value.String())
require.NoError(t, err)
Expand All @@ -91,7 +92,7 @@ func TestGetInstanceInternalIP(t *testing.T) {
apiMetadata.EXPECT().InternalIP().Return("10.0.0.1", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "internalIP"}))
value, err := plugin.Get(types.Path([]string{"instance", "internalIP"}))

require.EqualValues(t, `"10.0.0.1"`, value.String())
require.NoError(t, err)
Expand All @@ -102,7 +103,7 @@ func TestGetInstanceExternalIP(t *testing.T) {
apiMetadata.EXPECT().ExternalIP().Return("134.45.45.1", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "externalIP"}))
value, err := plugin.Get(types.Path([]string{"instance", "externalIP"}))

require.EqualValues(t, `"134.45.45.1"`, value.String())
require.NoError(t, err)
Expand All @@ -113,7 +114,7 @@ func TestGetInstanceHostname(t *testing.T) {
apiMetadata.EXPECT().Hostname().Return("HOSTNAME", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "hostname"}))
value, err := plugin.Get(types.Path([]string{"instance", "hostname"}))

require.EqualValues(t, `"HOSTNAME"`, value.String())
require.NoError(t, err)
Expand All @@ -124,7 +125,7 @@ func TestGetInstanceID(t *testing.T) {
apiMetadata.EXPECT().InstanceID().Return("ID", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "ID"}))
value, err := plugin.Get(types.Path([]string{"instance", "ID"}))

require.EqualValues(t, `"ID"`, value.String())
require.NoError(t, err)
Expand All @@ -135,7 +136,7 @@ func TestGetInstanceName(t *testing.T) {
apiMetadata.EXPECT().InstanceName().Return("NAME", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "name"}))
value, err := plugin.Get(types.Path([]string{"instance", "name"}))

require.EqualValues(t, `"NAME"`, value.String())
require.NoError(t, err)
Expand All @@ -146,7 +147,7 @@ func TestGetInstanceZone(t *testing.T) {
apiMetadata.EXPECT().Zone().Return("ZONE", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "zone"}))
value, err := plugin.Get(types.Path([]string{"instance", "zone"}))

require.EqualValues(t, `"ZONE"`, value.String())
require.NoError(t, err)
Expand All @@ -157,7 +158,7 @@ func TestGetInstanceNetwork(t *testing.T) {
apiMetadata.EXPECT().Get("instance/network-interfaces/0/network").Return("path/to/network", nil)

plugin := NewPlugin(api, apiMetadata)
value, err := plugin.Get(metadata.Path([]string{"instance", "network"}))
value, err := plugin.Get(types.Path([]string{"instance", "network"}))

require.EqualValues(t, `"network"`, value.String())
require.NoError(t, err)
Expand Down
3 changes: 2 additions & 1 deletion vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ github.com/Masterminds/sprig 2.9.0
github.com/Sirupsen/logrus v0.11.4
github.com/aokoli/goutils 1.0.0-1-g9c37978
github.com/davecgh/go-spew v1.1.0
github.com/docker/infrakit 05d22a5
github.com/docker/infrakit 0bda756
github.com/golang/mock bd3c8e8
github.com/golang/protobuf 69b215d
github.com/googleapis/gax-go da06d19
github.com/gorilla/context v1.1-7-g08b5f42
github.com/gorilla/mux v1.3.0-4-gad4ce0e
github.com/gorilla/rpc 22c016f
github.com/hashicorp/hcl 630949a3c5fa3c613328e1b8256052cbc2327c9b
github.com/inconshreveable/mousetrap 76626ae
github.com/jmespath/go-jmespath 0.2.2-14-gbd40a43
github.com/pmezard/go-difflib v1.0.0
Expand Down
7 changes: 7 additions & 0 deletions vendor/github.com/docker/infrakit/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 67 additions & 20 deletions vendor/github.com/docker/infrakit/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 6 additions & 10 deletions vendor/github.com/docker/infrakit/circle.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading