From 0cc7a6f3b6e72e0b4f54cdb5f0a4dddd7df23b7e Mon Sep 17 00:00:00 2001 From: Brett Lentz Date: Wed, 2 Jul 2014 11:56:52 -0400 Subject: [PATCH] add ability to replace existing Dyn records --- lib/fog/dynect/models/dns/record.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/fog/dynect/models/dns/record.rb b/lib/fog/dynect/models/dns/record.rb index 359eef309..95eb59b68 100644 --- a/lib/fog/dynect/models/dns/record.rb +++ b/lib/fog/dynect/models/dns/record.rb @@ -19,7 +19,7 @@ module Fog true end - def save + def save(replace=false) requires :name, :type, :rdata, :zone options = { @@ -27,7 +27,11 @@ module Fog } options.delete_if {|key, value| value.nil?} - data = service.post_record(type, zone.identity, name, rdata, options).body['data'] + if replace + data = service.put_record(type, zone.identity, name, rdata, options).body['data'] + else + data = service.post_record(type, zone.identity, name, rdata, options).body['data'] + end # avoid overwriting zone object with zone string data = data.reject {|key, value| key == 'zone'} merge_attributes(data)