New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should have option to gracefully handle existing A record for CNAME create #18

Closed
JeanMertz opened this Issue Mar 19, 2014 · 5 comments

Comments

Projects
None yet
3 participants
@JeanMertz

JeanMertz commented Mar 19, 2014

When doing a CNAME create action on a record with an existing A record, the following error is returned:

Excon::Errors::BadRequest: Expected(201) <=> Actual(400 Bad Request)

CNAME must be the only record on a subdomain

Obviously we can't expect Chef to continue, as that might throw off expectations, but an extra option force would allow us to remove any existing A records on that subdomain if set to true, or continue the current behaviour (default) if set to false.

Use case that runs into this:

our nodes can be created on both EC2 or other external hosts. If on EC2, we create a CNAME record for the by amazon provided DNS record (like ec2-53-214-183-212.eu-west-1.compute.amazonaws.com). However, when using a non-ec2 instance, we use the public_ip with an A record.

Switching between ec2 and non-ec2, you'd have to manually remove the records before continuing.

@aeden

This comment has been minimized.

Member

aeden commented Mar 19, 2014

The CNAME validation was a recent addition. The only concern I have with the proposal is that it might not only be an A record in the way. For example, there could be MX, CNAME, NS or any other type of record for that matter. I wonder if the risks associated with forcefully removing those records is too high?

@JeanMertz

This comment has been minimized.

JeanMertz commented Mar 19, 2014

@aeden does it error on MX/NS as well? I thought (although I am highly uninformed on anything DNS non-trivial) you should be allowed to have a CNAME record on top of MX/NS, as they are for different purposes.

I agree that it might be a high risk. Maybe a different solution would fit. Maybe a better solution would be to bundle some library helpers that help you check for existing records? You can then do what ever you want with those checks, but I'd wrap them in a delete, only_if { } block to delete any records before I try to create a new record.

Ideally, there'd be some kind of a_record_exists_for(domain) check (and possibly others, if useful). I'll see if I can whip something up in the next two or three weeks.

@aeden

This comment has been minimized.

Member

aeden commented Mar 19, 2014

Yes it will error for MX and NS and no you cannot have a CNAME with any other record of any other type (to be compliant with the DNS RFCs). This is the same reason CNAMEs on a zone apex are not allowed.

@martinisoft

This comment has been minimized.

Member

martinisoft commented Mar 6, 2015

hi @JeanMertz

I realize this issue has had no activity for a little while. Can you let us know if this issue is now resolved for you?

@JeanMertz

This comment has been minimized.

JeanMertz commented Mar 6, 2015

I'll close this issue @martinisoft, I am no longer actively working on Chef projects, so have no idea if this is still an issue, but at least it's not for me.

Thank you for your time and involvement 👍 😄

@JeanMertz JeanMertz closed this Mar 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment