1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[dynect|dns] Don't use address as different records have different arguments, just send rdata. Remove value. Add CNAME test.

This commit is contained in:
Dylan Egan 2011-09-03 13:41:53 -07:00
parent 1053dc7e34
commit 53bc5e3236
2 changed files with 8 additions and 7 deletions

View file

@ -13,7 +13,6 @@ module Fog
attribute :serial_style
attribute :ttl
attribute :type, :aliases => 'record_type'
attribute :value
def destroy
requires :identity, :name, :type, :zone
@ -22,14 +21,14 @@ module Fog
end
def save
requires :name, :type, :value, :zone
requires :name, :type, :rdata, :zone
options = {
:ttl => ttl
}
options.delete_if {|key, value| value.nil?}
data = connection.post_record(type, zone.identity, name, {'address' => value}, options).body['data']
data = connection.post_record(type, zone.identity, name, rdata, options).body['data']
# avoid overwriting zone object with zone string
data = data.reject {|key, value| key == 'zone'}
merge_attributes(data)

View file

@ -76,7 +76,7 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
})
tests("post_record('A', '#{@domain}', '#{@fqdn}', 'address' => '1.2.3.4')").formats(post_record_format) do
@dns.post_record('A', @domain, @fqdn, {'address' => '1.2.3.4'}, {}).body
@dns.post_record('A', @domain, @fqdn, {'address' => '1.2.3.4'}).body
end
publish_zone_format = shared_format.merge({
@ -126,10 +126,12 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
data
end
@dns.post_record('CNAME', @domain, @fqdn, {'address' => '1.2.3.4'}, {})
sleep 3 unless Fog.mocking?
tests("get_record('ANY', '#{@domain}', '#{@fqdn}')").formats(get_records_format) do
@dns.get_record('ANY', @domain, @fqdn)
@dns.post_record('CNAME', @domain, "cname.#{@fqdn}", {'cname' => "#{@fqdn}."})
tests("get_record('ANY', '#{@domain}', 'cname.#{@fqdn}')").formats(get_records_format) do
@dns.get_record('ANY', @domain, "cname.#{@fqdn}").body
end
get_record_format = shared_format.merge({