From cbb3ad3904e462abca4f277b550df06cb0180244 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 7 Feb 2023 07:29:17 -0500 Subject: [PATCH] Get zone from config --- lib/vmpooler/dns/gcp/clouddns.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb index 97377ba..48232c1 100644 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -44,14 +44,19 @@ module Vmpooler 'gcp-clouddns' end + # main configuration options + def zone_name + dns_config['zone_name'] + end + def create_or_replace_record(hostname) ip = get_ip(hostname) - connection.zone('vmpooler-example-com').add(hostname, 'A', 60, ip) + connection.zone(zone_name).add(hostname, 'A', 60, ip) end def delete_record(hostname) retries = 0 - connection.zone('vmpooler-example-com').remove(hostname, 'A') + connection.zone(zone_name).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]'