Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not quote challenge in DNS recordset #91

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package main

import (
"fmt"
"strconv"
"strings"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/dns/v2/recordsets"
Expand Down Expand Up @@ -67,7 +65,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 {
Expand Down Expand Up @@ -101,7 +99,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()
Expand Down Expand Up @@ -139,10 +136,3 @@ func (c *designateDNSProviderSolver) Initialize(kubeClientConfig *rest.Config, s
return nil
}

func quoteRecord(r string) string {
if strings.HasPrefix(r, "\"") && strings.HasSuffix(r, "\"") {
return r
} else {
return strconv.Quote(r)
}
}