mirror of
https://github.com/puppetlabs/vmpooler-dns-gcp.git
synced 2026-01-26 02:58:42 -05:00
Add delete record
This commit is contained in:
parent
d4bbd086ae
commit
ad57ae053f
1 changed files with 10 additions and 0 deletions
|
|
@ -49,6 +49,16 @@ module Vmpooler
|
||||||
connection.zone('vmpooler-example-com').add(hostname, 'A', 60, ip)
|
connection.zone('vmpooler-example-com').add(hostname, 'A', 60, ip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete_record(hostname)
|
||||||
|
retries = 0
|
||||||
|
connection.zone('vmpooler-example-com').remove(hostname, 'A')
|
||||||
|
rescue Google::Cloud::FailedPreconditionError => e
|
||||||
|
# this error was experienced intermittently, will retry to see if it can complete successfully
|
||||||
|
# the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]'
|
||||||
|
sleep 5
|
||||||
|
retry if (retries += 1) < 30
|
||||||
|
end
|
||||||
|
|
||||||
def connection
|
def connection
|
||||||
@connection_pool.with_metrics do |pool_object|
|
@connection_pool.with_metrics do |pool_object|
|
||||||
return ensured_gcp_connection(pool_object)
|
return ensured_gcp_connection(pool_object)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue