From 0fd90a8fa568106353ca5d27e4ddb1d16a0e0ddd Mon Sep 17 00:00:00 2001 From: geemus Date: Thu, 23 Dec 2010 14:21:05 -0800 Subject: [PATCH] [zerigo|dns] save or update models --- lib/fog/zerigo/models/dns/record.rb | 8 +++++++- lib/fog/zerigo/models/dns/zone.rb | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/fog/zerigo/models/dns/record.rb b/lib/fog/zerigo/models/dns/record.rb index a3229a4d0..f85fac51d 100644 --- a/lib/fog/zerigo/models/dns/record.rb +++ b/lib/fog/zerigo/models/dns/record.rb @@ -36,7 +36,13 @@ module Fog options[:notes] = notes if notes options[:priority] = priority if priority options[:ttl] = ttl if ttl - data = connection.create_host(@zone.id, type, ip, options) + data = unless identity + connection.create_host(@zone.id, type, ip, options) + else + options[:host_type] = type + options[:data] = data + connection.update_host(identity, options) + end merge_attributes(data.body) true end diff --git a/lib/fog/zerigo/models/dns/zone.rb b/lib/fog/zerigo/models/dns/zone.rb index 86d9b7c78..c5ae581d0 100644 --- a/lib/fog/zerigo/models/dns/zone.rb +++ b/lib/fog/zerigo/models/dns/zone.rb @@ -70,7 +70,13 @@ module Fog # * notes<~String> - notes about the domain # * restrict_axfr<~String> - indicates if AXFR transfers should be restricted to IPs in axfr-ips # * tag_list<~String> - List of all tags associated with this domain - data = connection.create_zone(domain, ttl, type, options) + data = unless identity + connection.create_zone(domain, ttl, type, options) + else + options[:default_ttl] = ttl + options[:ns_type] = type + connection.update_zone(identity, options) + end merge_attributes(data.body) true end