diff --git a/internal/cloud/openstack/openstack.go b/internal/cloud/openstack/openstack.go index ced06f395..225d5c597 100644 --- a/internal/cloud/openstack/openstack.go +++ b/internal/cloud/openstack/openstack.go @@ -307,16 +307,6 @@ func (c *Cloud) getLoadBalancerHost(ctx context.Context) (string, error) { return "", errors.New("no load balancer endpoint found") } -// GetNetworkIDs returns the IDs of the networks the current instance is part of. -// This method is OpenStack specific. -func (c *Cloud) GetNetworkIDs(ctx context.Context) ([]string, error) { - networkIDs, err := c.imds.networkIDs(ctx) - if err != nil { - return nil, fmt.Errorf("retrieving network IDs: %w", err) - } - return networkIDs, nil -} - func (c *Cloud) getSubnetCIDR(uidTag string) (netip.Prefix, error) { listSubnetsOpts := subnets.ListOpts{Tags: uidTag} subnetsPage, err := c.api.ListSubnets(listSubnetsOpts).AllPages() diff --git a/internal/cloud/openstack/openstack_test.go b/internal/cloud/openstack/openstack_test.go index c369486d9..b04048610 100644 --- a/internal/cloud/openstack/openstack_test.go +++ b/internal/cloud/openstack/openstack_test.go @@ -654,46 +654,6 @@ func TestGetLoadBalancerEndpoint(t *testing.T) { } } -func TestGetNetworkIDs(t *testing.T) { - someErr := fmt.Errorf("failed") - - testCases := map[string]struct { - imds imdsAPI - want []string - wantErr bool - }{ - "success": { - imds: &stubIMDSClient{ - networkIDsResult: []string{"id1", "id2"}, - }, - want: []string{"id1", "id2"}, - }, - "fail to get network IDs": { - imds: &stubIMDSClient{ - networkIDsErr: someErr, - }, - wantErr: true, - }, - } - - for name, tc := range testCases { - t.Run(name, func(t *testing.T) { - assert := assert.New(t) - - c := &Cloud{imds: tc.imds} - - got, err := c.GetNetworkIDs(context.Background()) - - if tc.wantErr { - assert.Error(err) - } else { - assert.NoError(err) - assert.Equal(tc.want, got) - } - }) - } -} - // newSubnetPager returns a subnet pager as we would get from a ListSubnets. func newSubnetPager(nets []subnets.Subnet, err error) stubPager { return stubPager{