Skip to content
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

handle reconciliation for zone creation in case the zone id did not get persisted #148

Open
rciorba opened this issue Mar 3, 2017 · 1 comment

Comments

@rciorba
Copy link
Contributor

rciorba commented Mar 3, 2017

In case zone.create fails, list all zones and match by CallerReference, if the config is the same, persist that Id, else delete the zone and create a new one.

Background:

So I've used the CallerReference for create_health_check operation to ensure my code can correctly handle transient error. So if I create the same exact HealthCheck twice, with the same CallerReference, the create is idempotent and I get back the first HealthCheck on the second create call. This allows me to ensure my code can recover in the event it called create_health_check but failed to persist the Id (*1).

However when I attempted to apply the same pattern to create_hosted_zone the second call always fails with "HostedZoneAlreadyExists".

(*1) If the second create_healthcheck has a different HealthCheckConfig the call fails as expected

@calind calind modified the milestone: Initial version Mar 3, 2017
@rciorba
Copy link
Contributor Author

rciorba commented Mar 3, 2017

@pytest.mark.django_db
def test_zone_reconcile(zone, boto_client):
    original_id = zone.route53_id
    zone.route53_id = None  # simulate failed create call
    zone.save()
    zone.route53_zone._clear_cache()
    zone.route53_zone.reconcile()
    assert zone.route53_id == original_id

@rciorba rciorba removed this from the Initial version milestone Mar 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants