From 8b3081ad103136f5777bba397d69876272e80dfb Mon Sep 17 00:00:00 2001 From: geemus Date: Tue, 21 Dec 2010 15:24:14 -0800 Subject: [PATCH] [slicehost|dns] give dns its own namespace/service --- lib/fog/slicehost.rb | 1 + lib/fog/slicehost/bin.rb | 2 + lib/fog/slicehost/compute.rb | 8 -- lib/fog/slicehost/dns.rb | 84 +++++++++++++++++++ .../parsers/{compute => dns}/create_record.rb | 2 +- .../parsers/{compute => dns}/create_zone.rb | 2 +- .../parsers/{compute => dns}/get_record.rb | 2 +- .../parsers/{compute => dns}/get_records.rb | 2 +- .../parsers/{compute => dns}/get_zone.rb | 2 +- .../parsers/{compute => dns}/get_zones.rb | 2 +- .../slicehost/requests/compute/dns_manager.rb | 75 ----------------- lib/fog/slicehost/requests/compute/mock.rb | 16 ---- .../{compute => dns}/create_record.rb | 6 +- .../requests/{compute => dns}/create_zone.rb | 6 +- .../{compute => dns}/delete_record.rb | 2 +- .../requests/{compute => dns}/delete_zone.rb | 2 +- .../requests/{compute => dns}/get_record.rb | 6 +- .../requests/{compute => dns}/get_records.rb | 6 +- .../requests/{compute => dns}/get_zone.rb | 6 +- .../requests/{compute => dns}/get_zones.rb | 6 +- .../{compute => dns_tests}/dns_tests.rb | 32 +++---- 21 files changed, 129 insertions(+), 141 deletions(-) create mode 100644 lib/fog/slicehost/dns.rb rename lib/fog/slicehost/parsers/{compute => dns}/create_record.rb (95%) rename lib/fog/slicehost/parsers/{compute => dns}/create_zone.rb (95%) rename lib/fog/slicehost/parsers/{compute => dns}/get_record.rb (95%) rename lib/fog/slicehost/parsers/{compute => dns}/get_records.rb (96%) rename lib/fog/slicehost/parsers/{compute => dns}/get_zone.rb (95%) rename lib/fog/slicehost/parsers/{compute => dns}/get_zones.rb (96%) delete mode 100644 lib/fog/slicehost/requests/compute/dns_manager.rb delete mode 100644 lib/fog/slicehost/requests/compute/mock.rb rename lib/fog/slicehost/requests/{compute => dns}/create_record.rb (93%) rename lib/fog/slicehost/requests/{compute => dns}/create_zone.rb (90%) rename lib/fog/slicehost/requests/{compute => dns}/delete_record.rb (97%) rename lib/fog/slicehost/requests/{compute => dns}/delete_zone.rb (97%) rename lib/fog/slicehost/requests/{compute => dns}/get_record.rb (87%) rename lib/fog/slicehost/requests/{compute => dns}/get_records.rb (87%) rename lib/fog/slicehost/requests/{compute => dns}/get_zone.rb (85%) rename lib/fog/slicehost/requests/{compute => dns}/get_zones.rb (85%) rename tests/slicehost/requests/{compute => dns_tests}/dns_tests.rb (84%) diff --git a/lib/fog/slicehost.rb b/lib/fog/slicehost.rb index a37f8e116..80cfb8950 100644 --- a/lib/fog/slicehost.rb +++ b/lib/fog/slicehost.rb @@ -10,6 +10,7 @@ module Fog service_path 'fog/slicehost' service :compute + service :dns def self.new(attributes = {}) location = caller.first diff --git a/lib/fog/slicehost/bin.rb b/lib/fog/slicehost/bin.rb index 783e10b2d..dd6114095 100644 --- a/lib/fog/slicehost/bin.rb +++ b/lib/fog/slicehost/bin.rb @@ -5,6 +5,8 @@ class Slicehost < Fog::Bin case key when :compute, :slices Fog::Slicehost::Compute + when :dns + Fog::Slicehost::DNS else raise ArgumentError, "Unrecognized service: #{key}" end diff --git a/lib/fog/slicehost/compute.rb b/lib/fog/slicehost/compute.rb index b0f46ff72..cb4a5df85 100644 --- a/lib/fog/slicehost/compute.rb +++ b/lib/fog/slicehost/compute.rb @@ -24,14 +24,6 @@ module Fog request :get_slice request :get_slices request :reboot_slice - request :create_zone - request :delete_zone - request :get_zones - request :get_zone - request :create_record - request :delete_record - request :get_records - request :get_record class Mock diff --git a/lib/fog/slicehost/dns.rb b/lib/fog/slicehost/dns.rb new file mode 100644 index 000000000..f478da54c --- /dev/null +++ b/lib/fog/slicehost/dns.rb @@ -0,0 +1,84 @@ +module Fog + module Slicehost + class DNS < Fog::Service + + requires :slicehost_password + recognizes :host, :port, :scheme, :persistent + + model_path 'fog/slicehost/models/dns' + + request_path 'fog/slicehost/requests/dns' + request :create_record + request :create_zone + request :delete_record + request :delete_zone + request :get_record + request :get_records + request :get_zone + request :get_zones + + class Mock + + def self.data + @data ||= Hash.new do |hash, key| + hash[key] = {} + end + end + + def self.reset_data(keys=data.keys) + for key in [*keys] + data.delete(key) + end + end + + def initialize(options={}) + @slicehost_password = options[:slicehost_password] + @data = self.class.data[@slicehost_password] + end + + end + + class Real + + def initialize(options={}) + @slicehost_password = options[:slicehost_password] + @host = options[:host] || "api.slicehost.com" + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + end + + def reload + @connection.reset + end + + def request(params) + params[:headers] ||= {} + params[:headers].merge!({ + 'Authorization' => "Basic #{Base64.encode64(@slicehost_password).delete("\r\n")}" + }) + case params[:method] + when 'DELETE', 'GET', 'HEAD' + params[:headers]['Accept'] = 'application/xml' + when 'POST', 'PUT' + params[:headers]['Content-Type'] = 'application/xml' + end + + begin + response = @connection.request(params.merge!({:host => @host})) + rescue Excon::Errors::HTTPStatusError => error + raise case error + when Excon::Errors::NotFound + Fog::Slicehost::DNS::NotFound.slurp(error) + else + error + end + end + + response + end + + end + end + end +end diff --git a/lib/fog/slicehost/parsers/compute/create_record.rb b/lib/fog/slicehost/parsers/dns/create_record.rb similarity index 95% rename from lib/fog/slicehost/parsers/compute/create_record.rb rename to lib/fog/slicehost/parsers/dns/create_record.rb index 5b487e777..b1d74ed82 100644 --- a/lib/fog/slicehost/parsers/compute/create_record.rb +++ b/lib/fog/slicehost/parsers/dns/create_record.rb @@ -1,7 +1,7 @@ module Fog module Parsers module Slicehost - module Compute + module DNS class CreateRecord < Fog::Parsers::Base diff --git a/lib/fog/slicehost/parsers/compute/create_zone.rb b/lib/fog/slicehost/parsers/dns/create_zone.rb similarity index 95% rename from lib/fog/slicehost/parsers/compute/create_zone.rb rename to lib/fog/slicehost/parsers/dns/create_zone.rb index c8c638a2e..e4c63816c 100644 --- a/lib/fog/slicehost/parsers/compute/create_zone.rb +++ b/lib/fog/slicehost/parsers/dns/create_zone.rb @@ -1,7 +1,7 @@ module Fog module Parsers module Slicehost - module Compute + module DNS class CreateZone < Fog::Parsers::Base diff --git a/lib/fog/slicehost/parsers/compute/get_record.rb b/lib/fog/slicehost/parsers/dns/get_record.rb similarity index 95% rename from lib/fog/slicehost/parsers/compute/get_record.rb rename to lib/fog/slicehost/parsers/dns/get_record.rb index 32d2e300f..9dbbf9040 100644 --- a/lib/fog/slicehost/parsers/compute/get_record.rb +++ b/lib/fog/slicehost/parsers/dns/get_record.rb @@ -1,7 +1,7 @@ module Fog module Parsers module Slicehost - module Compute + module DNS class GetRecord < Fog::Parsers::Base diff --git a/lib/fog/slicehost/parsers/compute/get_records.rb b/lib/fog/slicehost/parsers/dns/get_records.rb similarity index 96% rename from lib/fog/slicehost/parsers/compute/get_records.rb rename to lib/fog/slicehost/parsers/dns/get_records.rb index b7822bcdc..594ae3323 100644 --- a/lib/fog/slicehost/parsers/compute/get_records.rb +++ b/lib/fog/slicehost/parsers/dns/get_records.rb @@ -1,7 +1,7 @@ module Fog module Parsers module Slicehost - module Compute + module DNS class GetRecords < Fog::Parsers::Base diff --git a/lib/fog/slicehost/parsers/compute/get_zone.rb b/lib/fog/slicehost/parsers/dns/get_zone.rb similarity index 95% rename from lib/fog/slicehost/parsers/compute/get_zone.rb rename to lib/fog/slicehost/parsers/dns/get_zone.rb index 697949680..1064e7c25 100644 --- a/lib/fog/slicehost/parsers/compute/get_zone.rb +++ b/lib/fog/slicehost/parsers/dns/get_zone.rb @@ -1,7 +1,7 @@ module Fog module Parsers module Slicehost - module Compute + module DNS class GetZone < Fog::Parsers::Base diff --git a/lib/fog/slicehost/parsers/compute/get_zones.rb b/lib/fog/slicehost/parsers/dns/get_zones.rb similarity index 96% rename from lib/fog/slicehost/parsers/compute/get_zones.rb rename to lib/fog/slicehost/parsers/dns/get_zones.rb index 643b67381..97bd29086 100644 --- a/lib/fog/slicehost/parsers/compute/get_zones.rb +++ b/lib/fog/slicehost/parsers/dns/get_zones.rb @@ -1,7 +1,7 @@ module Fog module Parsers module Slicehost - module Compute + module DNS class GetZones < Fog::Parsers::Base diff --git a/lib/fog/slicehost/requests/compute/dns_manager.rb b/lib/fog/slicehost/requests/compute/dns_manager.rb deleted file mode 100644 index 011039a13..000000000 --- a/lib/fog/slicehost/requests/compute/dns_manager.rb +++ /dev/null @@ -1,75 +0,0 @@ - -# notes: slicehost finds records by id - need to check if others do the same (for zones & records) -# linode uses IDs -# - -# array won't work because ID will change when delete items -# hash - but need to generate a unique number - counter - -class DnsManager - - def initialize - @zones = {} - @zone_id_counter= 0 - @record_id_counter= 0 - end - - # add domain to list of zones and return a zone id. note, only domain name is manatory. any - # other desired fields can be included using options parameter - def create_zone( domain, options) - - #see if domain already has zone - zone_id= 0 - @zone.each { |id, zone| - if domain.casecmp zone[:domain] - zone_id= id - break - end - } - #if did not find, get a new zone ID - if zone_id == 0 - zone_id= get_zone_id - - #add fields to zone - zone = { :domain => domain } - options.each { |option, value| - zone[option] = value - } - - #add zone to dns manager - @zones[zone_id] = zone - - zone_id - end - - # update an existing zone with new data. any field can be updated included domain name - def update_zone( zone_id, domain, options) - #build zone hash - merge? - zone = {} - @zones[zone_id] = zone - end - - # remove a zone from the dns manager - def delete_zone( zone_id) - @zones.delete( zone_id) - end - - # get - def get_zone( zone_id) - @zones[zone_id] - end - - - #---------------------- - - def get_zone_id - @zone_id_counter+=1 - end - private :get_zone_id - - def get_record_id - @record_id_counter+=1 - end - private :get_record_id - -end \ No newline at end of file diff --git a/lib/fog/slicehost/requests/compute/mock.rb b/lib/fog/slicehost/requests/compute/mock.rb deleted file mode 100644 index db22378d2..000000000 --- a/lib/fog/slicehost/requests/compute/mock.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Fog - module Slicehost - class Compute - - class Mock - - def initialize - @slices = [] - @zones = [] - end - - end - - end - end -end diff --git a/lib/fog/slicehost/requests/compute/create_record.rb b/lib/fog/slicehost/requests/dns/create_record.rb similarity index 93% rename from lib/fog/slicehost/requests/compute/create_record.rb rename to lib/fog/slicehost/requests/dns/create_record.rb index 2580dae21..95cf1deb3 100644 --- a/lib/fog/slicehost/requests/compute/create_record.rb +++ b/lib/fog/slicehost/requests/dns/create_record.rb @@ -1,9 +1,9 @@ module Fog module Slicehost - class Compute + class DNS class Real - require 'fog/slicehost/parsers/compute/create_record' + require 'fog/slicehost/parsers/dns/create_record' # Create a new record in a DNS zone - or update an existing one # ==== Parameters @@ -42,7 +42,7 @@ module Fog :body => %Q{#{record_type}#{zone_id}#{name}#{data}#{optional_tags}}, :expects => 201, :method => 'POST', - :parser => Fog::Parsers::Slicehost::Compute::CreateRecord.new, + :parser => Fog::Parsers::Slicehost::DNS::CreateRecord.new, :path => 'records.xml' ) end diff --git a/lib/fog/slicehost/requests/compute/create_zone.rb b/lib/fog/slicehost/requests/dns/create_zone.rb similarity index 90% rename from lib/fog/slicehost/requests/compute/create_zone.rb rename to lib/fog/slicehost/requests/dns/create_zone.rb index 57c392ed3..4c78eec94 100644 --- a/lib/fog/slicehost/requests/compute/create_zone.rb +++ b/lib/fog/slicehost/requests/dns/create_zone.rb @@ -1,9 +1,9 @@ module Fog module Slicehost - class Compute + class DNS class Real - require 'fog/slicehost/parsers/compute/create_zone' + require 'fog/slicehost/parsers/dns/create_zone' # Create a new zone for Slicehost's DNS servers to serve/host # ==== Parameters @@ -35,7 +35,7 @@ module Fog :body => %Q{#{origin}#{optional_tags}}, :expects => 201, :method => 'POST', - :parser => Fog::Parsers::Slicehost::Compute::CreateZone.new, + :parser => Fog::Parsers::Slicehost::DNS::CreateZone.new, :path => 'zones.xml' ) end diff --git a/lib/fog/slicehost/requests/compute/delete_record.rb b/lib/fog/slicehost/requests/dns/delete_record.rb similarity index 97% rename from lib/fog/slicehost/requests/compute/delete_record.rb rename to lib/fog/slicehost/requests/dns/delete_record.rb index 98f8bfb78..7bd5d9826 100644 --- a/lib/fog/slicehost/requests/compute/delete_record.rb +++ b/lib/fog/slicehost/requests/dns/delete_record.rb @@ -1,6 +1,6 @@ module Fog module Slicehost - class Compute + class DNS class Real # Delete a record from the specified DNS zone diff --git a/lib/fog/slicehost/requests/compute/delete_zone.rb b/lib/fog/slicehost/requests/dns/delete_zone.rb similarity index 97% rename from lib/fog/slicehost/requests/compute/delete_zone.rb rename to lib/fog/slicehost/requests/dns/delete_zone.rb index 5657a2d78..3835dc744 100644 --- a/lib/fog/slicehost/requests/compute/delete_zone.rb +++ b/lib/fog/slicehost/requests/dns/delete_zone.rb @@ -1,6 +1,6 @@ module Fog module Slicehost - class Compute + class DNS class Real # Delete a zone from Slicehost's DNS diff --git a/lib/fog/slicehost/requests/compute/get_record.rb b/lib/fog/slicehost/requests/dns/get_record.rb similarity index 87% rename from lib/fog/slicehost/requests/compute/get_record.rb rename to lib/fog/slicehost/requests/dns/get_record.rb index 7e02f2a27..48f5cadc1 100644 --- a/lib/fog/slicehost/requests/compute/get_record.rb +++ b/lib/fog/slicehost/requests/dns/get_record.rb @@ -1,9 +1,9 @@ module Fog module Slicehost - class Compute + class DNS class Real - require 'fog/slicehost/parsers/compute/get_record' + require 'fog/slicehost/parsers/dns/get_record' # Get an individual DNS record from the specified zone # @@ -21,7 +21,7 @@ module Fog request( :expects => 200, :method => 'GET', - :parser => Fog::Parsers::Slicehost::Compute::GetRecords.new, + :parser => Fog::Parsers::Slicehost::DNS::GetRecords.new, :path => "records/#{record_id}.xml" ) end diff --git a/lib/fog/slicehost/requests/compute/get_records.rb b/lib/fog/slicehost/requests/dns/get_records.rb similarity index 87% rename from lib/fog/slicehost/requests/compute/get_records.rb rename to lib/fog/slicehost/requests/dns/get_records.rb index e4842d7fe..b990297ef 100644 --- a/lib/fog/slicehost/requests/compute/get_records.rb +++ b/lib/fog/slicehost/requests/dns/get_records.rb @@ -1,9 +1,9 @@ module Fog module Slicehost - class Compute + class DNS class Real - require 'fog/slicehost/parsers/compute/get_records' + require 'fog/slicehost/parsers/dns/get_records' # Get all the DNS records across all the DNS zones for this account # @@ -22,7 +22,7 @@ module Fog request( :expects => 200, :method => 'GET', - :parser => Fog::Parsers::Slicehost::Compute::GetRecords.new, + :parser => Fog::Parsers::Slicehost::DNS::GetRecords.new, :path => "records.xml" ) end diff --git a/lib/fog/slicehost/requests/compute/get_zone.rb b/lib/fog/slicehost/requests/dns/get_zone.rb similarity index 85% rename from lib/fog/slicehost/requests/compute/get_zone.rb rename to lib/fog/slicehost/requests/dns/get_zone.rb index 94a29fc54..e4d6d6055 100644 --- a/lib/fog/slicehost/requests/compute/get_zone.rb +++ b/lib/fog/slicehost/requests/dns/get_zone.rb @@ -1,9 +1,9 @@ module Fog module Slicehost - class Compute + class DNS class Real - require 'fog/slicehost/parsers/compute/get_zone' + require 'fog/slicehost/parsers/dns/get_zone' # Get details of a DNS zone # @@ -21,7 +21,7 @@ module Fog request( :expects => 200, :method => 'GET', - :parser => Fog::Parsers::Slicehost::Compute::GetZone.new, + :parser => Fog::Parsers::Slicehost::DNS::GetZone.new, :path => "/zones/#{zone_id}.xml" ) end diff --git a/lib/fog/slicehost/requests/compute/get_zones.rb b/lib/fog/slicehost/requests/dns/get_zones.rb similarity index 85% rename from lib/fog/slicehost/requests/compute/get_zones.rb rename to lib/fog/slicehost/requests/dns/get_zones.rb index b58b00015..ed8ca8580 100644 --- a/lib/fog/slicehost/requests/compute/get_zones.rb +++ b/lib/fog/slicehost/requests/dns/get_zones.rb @@ -1,9 +1,9 @@ module Fog module Slicehost - class Compute + class DNS class Real - require 'fog/slicehost/parsers/compute/get_zones' + require 'fog/slicehost/parsers/dns/get_zones' # Get list of all DNS zones hosted on Slicehost (for this account) # @@ -19,7 +19,7 @@ module Fog request( :expects => 200, :method => 'GET', - :parser => Fog::Parsers::Slicehost::Compute::GetZones.new, + :parser => Fog::Parsers::Slicehost::DNS::GetZones.new, :path => 'zones.xml' ) end diff --git a/tests/slicehost/requests/compute/dns_tests.rb b/tests/slicehost/requests/dns_tests/dns_tests.rb similarity index 84% rename from tests/slicehost/requests/compute/dns_tests.rb rename to tests/slicehost/requests/dns_tests/dns_tests.rb index 3644280a1..6c198971e 100644 --- a/tests/slicehost/requests/compute/dns_tests.rb +++ b/tests/slicehost/requests/dns_tests/dns_tests.rb @@ -1,4 +1,4 @@ -Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do +Shindo.tests('Slicehost::dns | DNS requests', ['slicehost', 'dns']) do @domain = '' @new_zones = [] @@ -22,7 +22,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do pending if Fog.mocking? @org_zone_count= 0 - response = Slicehost[:compute].get_zones() + response = Slicehost[:dns].get_zones() if response.status == 200 zones = response.body['zones'] @org_zone_count = zones.count @@ -35,7 +35,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do pending if Fog.mocking? domain = generate_unique_domain( true) - response = Slicehost[:compute].create_zone(domain) + response = Slicehost[:dns].create_zone(domain) if response.status == 201 zone_id = response.body['id'] @new_zones << zone_id @@ -49,7 +49,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do options = { :ttl => 1800, :active => 'N' } @domain= generate_unique_domain( true) - response = Slicehost[:compute].create_zone( @domain, options) + response = Slicehost[:dns].create_zone( @domain, options) if response.status == 201 @zone_id = response.body['id'] @new_zones << @zone_id @@ -63,7 +63,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do result= false - response = Slicehost[:compute].get_zone( @zone_id) + response = Slicehost[:dns].get_zone( @zone_id) if response.status == 200 zone = response.body if (zone['origin'] == @domain) and (zone['ttl'] == 1800) and @@ -80,7 +80,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do result= false - response = Slicehost[:compute].get_zones() + response = Slicehost[:dns].get_zones() if response.status == 200 zones = response.body['zones'] if (@org_zone_count+2) == zones.count @@ -96,7 +96,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do result= false - response = Slicehost[:compute].get_zones() + response = Slicehost[:dns].get_zones() if response.status == 200 zones = response.body['zones'] zones.each { |zone| @@ -120,7 +120,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do host= 'www.' + @domain zone_id= @new_zones[1] - response = Slicehost[:compute].create_record( 'A', zone_id, host, '1.2.3.4') + response = Slicehost[:dns].create_record( 'A', zone_id, host, '1.2.3.4') if response.status == 201 record_id = response.body['id'] @new_records << record_id @@ -135,7 +135,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do host= 'ftp.' + @domain zone_id= @new_zones[1] options = { :ttl => 3600, :active => 'N'} - response = Slicehost[:compute].create_record( 'A', zone_id, host, '1.2.3.4', options) + response = Slicehost[:dns].create_record( 'A', zone_id, host, '1.2.3.4', options) if response.status == 201 record_id = response.body['id'] @new_records << record_id @@ -148,7 +148,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do pending if Fog.mocking? zone_id= @new_zones[1] - response = Slicehost[:compute].create_record( 'CNAME', zone_id, 'mail', @domain) + response = Slicehost[:dns].create_record( 'CNAME', zone_id, 'mail', @domain) if response.status == 201 record_id = response.body['id'] @new_records << record_id @@ -163,7 +163,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do ns_domain = 'ns.' + @domain zone_id= @new_zones[1] options = { :ttl => 3600, :active => 'N'} - response = Slicehost[:compute].create_record( 'NS', zone_id, @domain, ns_domain, options) + response = Slicehost[:dns].create_record( 'NS', zone_id, @domain, ns_domain, options) if response.status == 201 record_id = response.body['id'] @new_records << record_id @@ -178,7 +178,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do mail_domain = 'mail.' + @domain zone_id= @new_zones[1] options = { :ttl => 3600, :active => 'N', :aux => '10'} - response = Slicehost[:compute].create_record( 'MX', zone_id, @domain, mail_domain, options) + response = Slicehost[:dns].create_record( 'MX', zone_id, @domain, mail_domain, options) if response.status == 201 @record_id = response.body['id'] @new_records << @record_id @@ -192,7 +192,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do result= false - response = Slicehost[:compute].get_record(@record_id) + response = Slicehost[:dns].get_record(@record_id) if response.status == 200 mail_domain = 'mail.' + @domain record = response.body['records'][0] @@ -211,7 +211,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do result= false - response = Slicehost[:compute].get_records() + response = Slicehost[:dns].get_records() if response.status == 200 records = response.body['records'] @@ -239,7 +239,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do result= true @new_records.each { |record_id| - response = Slicehost[:compute].delete_record( record_id) + response = Slicehost[:dns].delete_record( record_id) if response.status != 200 result= false; end @@ -253,7 +253,7 @@ Shindo.tests('Slicehost::Compute | DNS requests', ['slicehost', 'dns']) do result= true @new_zones.each { |zone_id| - response = Slicehost[:compute].delete_zone( zone_id) + response = Slicehost[:dns].delete_zone( zone_id) if response.status != 200 result= false; end