From e7cc5df3f6ede529efc79159eea6de39d3ca84bd Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 27 Apr 2018 13:15:59 -0700 Subject: [PATCH] Use cloudprovider.NotImplemented in AddSSHKeyToAllInstances Minor cleanup: In looking at implementations of this method, noticed a few providers created their own errors instead of using cloudprovider.NotImplemented --- pkg/cloudprovider/providers/azure/azure_instances.go | 3 +-- pkg/cloudprovider/providers/cloudstack/cloudstack_instances.go | 2 +- pkg/cloudprovider/providers/cloudstack/metadata.go | 2 +- pkg/volume/cinder/attacher_test.go | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/cloudprovider/providers/azure/azure_instances.go b/pkg/cloudprovider/providers/azure/azure_instances.go index c31003c3792..9f5de04c023 100644 --- a/pkg/cloudprovider/providers/azure/azure_instances.go +++ b/pkg/cloudprovider/providers/azure/azure_instances.go @@ -18,7 +18,6 @@ package azure import ( "context" - "fmt" "os" "strings" @@ -216,7 +215,7 @@ func (az *Cloud) InstanceType(ctx context.Context, name types.NodeName) (string, // AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances // expected format for the key is standard ssh-keygen format: func (az *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error { - return fmt.Errorf("not supported") + return cloudprovider.NotImplemented } // CurrentNodeName returns the name of the node we are currently running on. diff --git a/pkg/cloudprovider/providers/cloudstack/cloudstack_instances.go b/pkg/cloudprovider/providers/cloudstack/cloudstack_instances.go index 7e51811328f..264f43d1bc7 100644 --- a/pkg/cloudprovider/providers/cloudstack/cloudstack_instances.go +++ b/pkg/cloudprovider/providers/cloudstack/cloudstack_instances.go @@ -130,7 +130,7 @@ func (cs *CSCloud) InstanceTypeByProviderID(ctx context.Context, providerID stri // AddSSHKeyToAllInstances is currently not implemented. func (cs *CSCloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error { - return errors.New("AddSSHKeyToAllInstances not implemented") + return cloudprovider.NotImplemented } // CurrentNodeName returns the name of the node we are currently running on. diff --git a/pkg/cloudprovider/providers/cloudstack/metadata.go b/pkg/cloudprovider/providers/cloudstack/metadata.go index 26eb9040702..a7204d5d399 100644 --- a/pkg/cloudprovider/providers/cloudstack/metadata.go +++ b/pkg/cloudprovider/providers/cloudstack/metadata.go @@ -101,7 +101,7 @@ func (m *metadata) InstanceTypeByProviderID(ctx context.Context, providerID stri // AddSSHKeyToAllInstances is currently not implemented. func (m *metadata) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error { - return errors.New("AddSSHKeyToAllInstances not implemented") + return cloudprovider.NotImplemented } // CurrentNodeName returns the name of the node we are currently running on. diff --git a/pkg/volume/cinder/attacher_test.go b/pkg/volume/cinder/attacher_test.go index 409d018843b..e7961d9b72f 100644 --- a/pkg/volume/cinder/attacher_test.go +++ b/pkg/volume/cinder/attacher_test.go @@ -737,7 +737,7 @@ func (instances *instances) List(filter string) ([]types.NodeName, error) { } func (instances *instances) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error { - return errors.New("Not implemented") + return cloudprovider.NotImplemented } func (instances *instances) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) {