danielpigott / cloudflare-cli

CLI for interacting with Cloudflare
MIT License
210 stars 40 forks source link

Idempotent DNS Add/Remove #53

Open sufyanadam opened 4 years ago

sufyanadam commented 4 years ago

Is there an option we can pass so that cfcli add -t CNAME some-cname some-host does not fail if the record exists already? Maybe log a message that the record already exists. This would be helpful while building automations. Same for remove behaviour. Would this be possible?

danielpigott commented 4 years ago

Sorry for the delay in responding to this, I haven't been working on this project at all. I could probably add a flag to ignore failures. Will look at doing that as part of the next update

lapwat commented 3 years ago

@sufyanadam Maybe you can ignore the error in your bash command:

cfcli add -t CNAME some-cname some-host || true

sufyanadam commented 2 years ago

@lapwat that's what I'm doing for now.

sufyanadam commented 2 years ago

@lapwat @danielpigott ignoring the error with || true doesn't work for cases where you don't want the error ignored. For example creating the record failed due to invalid or empty DNS parameters. When building automations you want to know if there was something wrong with the input vs it already exists.