Skip to content

Commit

Permalink
types/openstack: drop GetImageNames method
Browse files Browse the repository at this point in the history
With baseimage user query removed from TUI, this function is no longer required.

This also
- drops the vendored files
- updates the mocks using `hack/go-genmock.sh`
  • Loading branch information
abhinavdahiya committed Jan 11, 2019
1 parent d656937 commit 83d9bf8
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 845 deletions.
4 changes: 1 addition & 3 deletions Gopkg.lock

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

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

10 changes: 0 additions & 10 deletions pkg/types/openstack/validation/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestValidatePlatform(t *testing.T) {
platform *openstack.Platform
noClouds bool
noRegions bool
noImages bool
noNetworks bool
noFlavors bool
noNetExts bool
Expand Down Expand Up @@ -127,15 +126,6 @@ func TestValidatePlatform(t *testing.T) {
Return([]string{"test-region"}, nil).
MaxTimes(1)
}
if tc.noImages {
fetcher.EXPECT().GetImageNames(tc.platform.Cloud).
Return(nil, errors.New("no images")).
MaxTimes(1)
} else {
fetcher.EXPECT().GetImageNames(tc.platform.Cloud).
Return([]string{"test-image"}, nil).
MaxTimes(1)
}
if tc.noNetworks {
fetcher.EXPECT().GetNetworkNames(tc.platform.Cloud).
Return(nil, errors.New("no networks")).
Expand Down
31 changes: 0 additions & 31 deletions pkg/types/openstack/validation/realvalidvaluesfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/gophercloud/gophercloud/openstack/common/extensions"
"github.com/gophercloud/gophercloud/openstack/compute/v2/flavors"
"github.com/gophercloud/gophercloud/openstack/identity/v3/regions"
"github.com/gophercloud/gophercloud/openstack/imageservice/v2/images"
netext "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/utils/openstack/clientconfig"
Expand Down Expand Up @@ -62,36 +61,6 @@ func (f realValidValuesFetcher) GetRegionNames(cloud string) ([]string, error) {
return regionNames, nil
}

// GetImageNames gets the valid image names.
func (f realValidValuesFetcher) GetImageNames(cloud string) ([]string, error) {
opts := &clientconfig.ClientOpts{
Cloud: cloud,
}

conn, err := clientconfig.NewServiceClient("image", opts)
if err != nil {
return nil, err
}

listOpts := images.ListOpts{}
allPages, err := images.List(conn, listOpts).AllPages()
if err != nil {
return nil, err
}

allImages, err := images.ExtractImages(allPages)
if err != nil {
return nil, err
}

imageNames := make([]string, len(allImages))
for x, image := range allImages {
imageNames[x] = image.Name
}

return imageNames, nil
}

// GetNetworkNames gets the valid network names.
func (f realValidValuesFetcher) GetNetworkNames(cloud string) ([]string, error) {
opts := &clientconfig.ClientOpts{
Expand Down
2 changes: 0 additions & 2 deletions pkg/types/openstack/validation/validvaluesfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ type ValidValuesFetcher interface {
GetCloudNames() ([]string, error)
// GetRegionNames gets the valid region names.
GetRegionNames(cloud string) ([]string, error)
// GetImageNames gets the valid image names.
GetImageNames(cloud string) ([]string, error)
// GetNetworkNames gets the valid network names.
GetNetworkNames(cloud string) ([]string, error)
// GetFlavorNames gets the valid flavor names.
Expand Down
1 change: 0 additions & 1 deletion pkg/types/validation/installconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ func TestValidateInstallConfig(t *testing.T) {
fetcher := mock.NewMockValidValuesFetcher(mockCtrl)
fetcher.EXPECT().GetCloudNames().Return([]string{"test-cloud"}, nil).AnyTimes()
fetcher.EXPECT().GetRegionNames(gomock.Any()).Return([]string{"test-region"}, nil).AnyTimes()
fetcher.EXPECT().GetImageNames(gomock.Any()).Return([]string{"test-image"}, nil).AnyTimes()
fetcher.EXPECT().GetNetworkNames(gomock.Any()).Return([]string{"test-network"}, nil).AnyTimes()
fetcher.EXPECT().GetFlavorNames(gomock.Any()).Return([]string{"test-flavor"}, nil).AnyTimes()
fetcher.EXPECT().GetNetworkExtensionsAliases(gomock.Any()).Return([]string{"trunk"}, nil).AnyTimes()
Expand Down

This file was deleted.

Loading

0 comments on commit 83d9bf8

Please sign in to comment.