Catch duplicate db inserts in powerdns plugin
Catches duplicate db exceptions in the powerdns plugin, allowing it to recover when a create is initially successful, but doesn't propagate fast enough Change-Id: I1a9d66c069b1f0f231618a369e31ce9be2e3c5c5 closes-bug: 1594582
This commit is contained in:
parent
812780d45b
commit
424ebf3206
@ -19,6 +19,7 @@ import threading
|
|||||||
import six
|
import six
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db import options
|
from oslo_db import options
|
||||||
|
from oslo_db.exception import DBDuplicateEntry
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from sqlalchemy.sql import select
|
from sqlalchemy.sql import select
|
||||||
@ -136,6 +137,11 @@ class PowerDNSBackend(base.Backend):
|
|||||||
}
|
}
|
||||||
|
|
||||||
self._create(tables.domains, domain_values)
|
self._create(tables.domains, domain_values)
|
||||||
|
except DBDuplicateEntry:
|
||||||
|
LOG.debug('Successful create of %s in pdns, zone already exists'
|
||||||
|
% zone['name'])
|
||||||
|
# If create fails because the zone exists, don't reraise
|
||||||
|
pass
|
||||||
except Exception:
|
except Exception:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user