Skip to content

Commit 437a826

Browse files
committed
fix createRecord for alibabacloud provider
1 parent c02fd68 commit 437a826

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

provider/alibabacloud/alibaba_cloud.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,21 @@ func (p *AlibabaCloudProvider) unescapeTXTRecordValue(value string) string {
498498
}
499499

500500
func (p *AlibabaCloudProvider) createRecord(endpoint *endpoint.Endpoint, target string, hostedZoneDomains []string) error {
501+
502+
if len(hostedZoneDomains) == 0 {
503+
log.Errorf("Failed to create %s record named '%s' to '%s' for Alibaba Cloud DNS: not found any zone,please add the DNS zone first",
504+
endpoint.RecordType, endpoint.DNSName, target)
505+
return fmt.Errorf("no found any zone,please add the DNS zone first")
506+
}
507+
501508
rr, domain := p.splitDNSName(endpoint.DNSName, hostedZoneDomains)
509+
510+
if domain == "" {
511+
log.Errorf("Failed to create %s record named '%s' to '%s' for Alibaba Cloud DNS: no coorsponing DNS zone found for this domain '%s',please add the DNS zone first",
512+
endpoint.RecordType, endpoint.DNSName, target, endpoint.DNSName)
513+
return fmt.Errorf("no corresponding DNS zone found for this domain. Please add the DNS zone first")
514+
}
515+
502516
request := alidns.CreateAddDomainRecordRequest()
503517
request.DomainName = domain
504518
request.Type = endpoint.RecordType

0 commit comments

Comments
 (0)