File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -462,18 +462,25 @@ func (w *Worker) createDomain(ctx context.Context, d *domain) error {
462462}
463463
464464func (w * Worker ) deleteDomain (ctx context.Context , d * domain ) error {
465+ deleteDomain := func () error {
466+ if ! d .CDN {
467+ return nil
468+ }
469+ return w .removeDomain (ctx , d .ID )
470+ }
471+
465472 hostnameID , err := w .Client .CustomHostnameIDByName (ctx , w .ZoneID , d .Domain )
466473 {
467474 var serr * cloudflare.RequestError
468475 if errors .As (err , & serr ) {
469476 if lo .Contains (serr .ErrorCodes (), 1407 ) {
470- return w . removeDomain ( ctx , d . ID )
477+ return deleteDomain ( )
471478 }
472479 }
473480 }
474481 if err != nil {
475482 if err .Error () == "CustomHostname could not be found" { // TODO: cloudflare-go hardcode this error
476- return w . removeDomain ( ctx , d . ID )
483+ return deleteDomain ( )
477484 }
478485 return err
479486 }
@@ -483,7 +490,7 @@ func (w *Worker) deleteDomain(ctx context.Context, d *domain) error {
483490 return err
484491 }
485492
486- return w . removeDomain ( ctx , d . ID )
493+ return deleteDomain ( )
487494}
488495
489496func (w * Worker ) updateStatus (ctx context.Context , d * domain ) error {
You can’t perform that action at this time.
0 commit comments