mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 17:46:57 +02:00
Merge pull request #3342 from tommy31/improve/gandi_multi_rsetvalues
fix(gandi): allow grandi provider to support multiple TXT rsetvalues
This commit is contained in:
commit
ec644802af
@ -16,7 +16,6 @@ package gandi
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -121,11 +120,17 @@ func (p *GandiProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, erro
|
|||||||
name = zone
|
name = zone
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.RrsetValues) > 1 {
|
for _, v := range r.RrsetValues {
|
||||||
return nil, fmt.Errorf("can't handle multiple values for rrset %s", name)
|
log.WithFields(log.Fields{
|
||||||
}
|
"record": r.RrsetName,
|
||||||
|
"type": r.RrsetType,
|
||||||
|
"value": v,
|
||||||
|
"ttl": r.RrsetTTL,
|
||||||
|
"zone": zone,
|
||||||
|
}).Debug("Returning endpoint record")
|
||||||
|
|
||||||
endpoints = append(endpoints, endpoint.NewEndpoint(name, r.RrsetType, r.RrsetValues[0]))
|
endpoints = append(endpoints, endpoint.NewEndpoint(name, r.RrsetType, v))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-gandi/go-gandi/domain"
|
"github.com/go-gandi/go-gandi/domain"
|
||||||
@ -342,7 +341,7 @@ func TestGandiProvider_RecordsAppliesDomainFilter(t *testing.T) {
|
|||||||
td.Cmp(t, expectedActions, mockedClient.Actions)
|
td.Cmp(t, expectedActions, mockedClient.Actions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGandiProvider_RecordsErrorOnMultipleValues(t *testing.T) {
|
func TestGandiProvider_RecordsWithMultipleValues(t *testing.T) {
|
||||||
mockedClient := mockGandiClientNewWithRecords([]livedns.DomainRecord{
|
mockedClient := mockGandiClientNewWithRecords([]livedns.DomainRecord{
|
||||||
{
|
{
|
||||||
RrsetValues: []string{"foo", "bar"},
|
RrsetValues: []string{"foo", "bar"},
|
||||||
@ -355,23 +354,11 @@ func TestGandiProvider_RecordsErrorOnMultipleValues(t *testing.T) {
|
|||||||
LiveDNSClient: mockedClient,
|
LiveDNSClient: mockedClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedActions := []MockAction{
|
|
||||||
{
|
|
||||||
Name: "ListDomains",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "GetDomainRecords",
|
|
||||||
FQDN: "example.com",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
endpoints, err := mockedProvider.Records(context.Background())
|
endpoints, err := mockedProvider.Records(context.Background())
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.Errorf("expected to fail")
|
t.Errorf("should not fail, %s", err)
|
||||||
}
|
}
|
||||||
assert.Equal(t, 0, len(endpoints))
|
assert.Equal(t, 2, len(endpoints))
|
||||||
assert.True(t, strings.HasPrefix(err.Error(), "can't handle multiple values for rrset"))
|
|
||||||
td.Cmp(t, expectedActions, mockedClient.Actions)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGandiProvider_ApplyChangesEmpty(t *testing.T) {
|
func TestGandiProvider_ApplyChangesEmpty(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user