oraclecloud: fix subdomain support (#1055)
This commit is contained in:
parent
4901bb4fe7
commit
68842b3b70
1 changed files with 13 additions and 3 deletions
|
@ -85,6 +85,11 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
fqdn, value := dns01.GetRecord(domain, keyAuth)
|
||||
|
||||
zoneNameOrID, err1 := dns01.FindZoneByFqdn(dns01.ToFqdn(domain))
|
||||
if err1 != nil {
|
||||
return fmt.Errorf("oraclecloud: could not find zone for domain %q and fqdn %q : %w", domain, fqdn, err1)
|
||||
}
|
||||
|
||||
// generate request to dns.PatchDomainRecordsRequest
|
||||
recordOperation := dns.RecordOperation{
|
||||
Domain: common.String(dns01.UnFqdn(fqdn)),
|
||||
|
@ -96,7 +101,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
|
||||
request := dns.PatchDomainRecordsRequest{
|
||||
CompartmentId: common.String(d.config.CompartmentID),
|
||||
ZoneNameOrId: common.String(domain),
|
||||
ZoneNameOrId: common.String(zoneNameOrID),
|
||||
Domain: common.String(dns01.UnFqdn(fqdn)),
|
||||
PatchDomainRecordsDetails: dns.PatchDomainRecordsDetails{
|
||||
Items: []dns.RecordOperation{recordOperation},
|
||||
|
@ -115,9 +120,14 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||
fqdn, value := dns01.GetRecord(domain, keyAuth)
|
||||
|
||||
zoneNameOrID, err1 := dns01.FindZoneByFqdn(dns01.ToFqdn(domain))
|
||||
if err1 != nil {
|
||||
return fmt.Errorf("oraclecloud: could not find zone for domain %q and fqdn %q : %w", domain, fqdn, err1)
|
||||
}
|
||||
|
||||
// search to TXT record's hash to delete
|
||||
getRequest := dns.GetDomainRecordsRequest{
|
||||
ZoneNameOrId: common.String(domain),
|
||||
ZoneNameOrId: common.String(zoneNameOrID),
|
||||
Domain: common.String(dns01.UnFqdn(fqdn)),
|
||||
CompartmentId: common.String(d.config.CompartmentID),
|
||||
Rtype: common.String("TXT"),
|
||||
|
@ -152,7 +162,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
}
|
||||
|
||||
patchRequest := dns.PatchDomainRecordsRequest{
|
||||
ZoneNameOrId: common.String(domain),
|
||||
ZoneNameOrId: common.String(zoneNameOrID),
|
||||
Domain: common.String(dns01.UnFqdn(fqdn)),
|
||||
PatchDomainRecordsDetails: dns.PatchDomainRecordsDetails{
|
||||
Items: []dns.RecordOperation{recordOperation},
|
||||
|
|
Loading…
Reference in a new issue