@@ -102,29 +102,25 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
102102
103103 recordName := getRecordName (fqdn , authZone )
104104
105- rrSet , err := d .client .GetTxtRRSet (dns01 .UnFqdn (authZone ), recordName )
106-
107- var nf * internal.NotFound
108- if err != nil && ! errors .As (err , & nf ) {
109- return fmt .Errorf ("desec: failed to get records: %w" , err )
110- }
105+ domainName := dns01 .UnFqdn (authZone )
111106
107+ rrSet , err := d .client .GetTxtRRSet (domainName , recordName )
112108 if err != nil {
113109 var nf * internal.NotFound
114110 if ! errors .As (err , & nf ) {
115- return fmt .Errorf ("desec: failed to get records: %w" , err )
111+ return fmt .Errorf ("desec: failed to get records: domainName=%s, recordName=%s: %w" , domainName , recordName , err )
116112 }
117113
118114 // Not found case -> create
119115 _ , err = d .client .AddTxtRRSet (internal.RRSet {
120- Domain : dns01 . UnFqdn ( authZone ) ,
116+ Domain : domainName ,
121117 SubName : recordName ,
122118 Type : "TXT" ,
123119 Records : []string {quotedValue },
124120 TTL : d .config .TTL ,
125121 })
126122 if err != nil {
127- return fmt .Errorf ("desec: failed to create records: %w" , err )
123+ return fmt .Errorf ("desec: failed to create records: domainName=%s, recordName=%s: %w" , domainName , recordName , err )
128124 }
129125
130126 return nil
@@ -133,9 +129,9 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
133129 // update
134130 records := append (rrSet .Records , quotedValue )
135131
136- _ , err = d .client .UpdateTxtRRSet (dns01 . UnFqdn ( authZone ) , recordName , records )
132+ _ , err = d .client .UpdateTxtRRSet (domainName , recordName , records )
137133 if err != nil {
138- return fmt .Errorf ("desec: failed to update records: %w" , err )
134+ return fmt .Errorf ("desec: failed to update records: domainName=%s, recordName=%s: %w" , domainName , recordName , err )
139135 }
140136
141137 return nil
@@ -152,9 +148,11 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
152148
153149 recordName := getRecordName (fqdn , authZone )
154150
155- rrSet , err := d .client .GetTxtRRSet (dns01 .UnFqdn (authZone ), recordName )
151+ domainName := dns01 .UnFqdn (authZone )
152+
153+ rrSet , err := d .client .GetTxtRRSet (domainName , recordName )
156154 if err != nil {
157- return fmt .Errorf ("desec: failed to create records: %w" , err )
155+ return fmt .Errorf ("desec: failed to get records: domainName=%s, recordName=%s: %w" , domainName , recordName , err )
158156 }
159157
160158 records := make ([]string , 0 )
@@ -164,9 +162,9 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
164162 }
165163 }
166164
167- _ , err = d .client .UpdateTxtRRSet (dns01 . UnFqdn ( authZone ) , recordName , records )
165+ _ , err = d .client .UpdateTxtRRSet (domainName , recordName , records )
168166 if err != nil {
169- return fmt .Errorf ("desec: failed to update records: %w" , err )
167+ return fmt .Errorf ("desec: failed to update records: domainName=%s, recordName=%s: %w" , domainName , recordName , err )
170168 }
171169
172170 return nil
0 commit comments