From 319fa40080a84fdc335eb45033add6a078952abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Revillard?= Date: Tue, 22 Nov 2022 12:31:13 +0100 Subject: [PATCH 1/3] Do not quote token --- main.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/main.go b/main.go index 48db755e..02d14d45 100644 --- a/main.go +++ b/main.go @@ -67,7 +67,7 @@ func (c *designateDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) erro var opts recordsets.CreateOpts opts.Name = ch.ResolvedFQDN opts.Type = "TXT" - opts.Records = []string{quoteRecord(ch.Key)} + opts.Records = []string{ch.Key} _, err = recordsets.Create(c.client, allZones[0].ID, opts).Extract() if err != nil { @@ -138,11 +138,3 @@ func (c *designateDNSProviderSolver) Initialize(kubeClientConfig *rest.Config, s c.client = cl return nil } - -func quoteRecord(r string) string { - if strings.HasPrefix(r, "\"") && strings.HasSuffix(r, "\"") { - return r - } else { - return strconv.Quote(r) - } -} From 59f2b18d6ba31b0e14ab865feec31023ab91c221 Mon Sep 17 00:00:00 2001 From: Jerome Revillard Date: Wed, 11 Jan 2023 15:00:22 +0100 Subject: [PATCH 2/3] Do not filter by key for deletion as we delete the recordset --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 02d14d45..4c193265 100644 --- a/main.go +++ b/main.go @@ -101,7 +101,6 @@ func (c *designateDNSProviderSolver) CleanUp(ch *v1alpha1.ChallengeRequest) erro recordListOpts := recordsets.ListOpts{ Name: ch.ResolvedFQDN, Type: "TXT", - Data: quoteRecord(ch.Key), } allRecordPages, err := recordsets.ListByZone(c.client, allZones[0].ID, recordListOpts).AllPages() @@ -138,3 +137,4 @@ func (c *designateDNSProviderSolver) Initialize(kubeClientConfig *rest.Config, s c.client = cl return nil } + From 9e83adcd3fa230594033f4f34721c51927ec23ef Mon Sep 17 00:00:00 2001 From: Jerome Revillard Date: Wed, 11 Jan 2023 15:07:48 +0100 Subject: [PATCH 3/3] Cleanup imports --- main.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/main.go b/main.go index 4c193265..e2e7ed34 100644 --- a/main.go +++ b/main.go @@ -2,8 +2,6 @@ package main import ( "fmt" - "strconv" - "strings" "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack/dns/v2/recordsets"