lib/rubber/dns/dyndns.rb in rubber-1.5.5 vs lib/rubber/dns/dyndns.rb in rubber-1.5.6

- old
+ new

@@ -27,16 +27,16 @@ opts = setup_opts(opts, [:host, :domain]) hostname = "#{opts[:host]}.#{opts[:domain]}" begin Resolv::DNS.open(:nameserver => [nameserver], :search => [], :ndots => 1) do |dns| r = dns.getresource(hostname, Resolv::DNS::Resource::IN::A) - result = [{:host =>host, :data => r.address}] + result = [{:host =>opts[:host], :data => r.address}] end rescue + puts "Rescue #{e} #{e.message}" raise "Domain needs to exist in dyndns as an A record before record can be updated" end - return true end def create_host_record(opts={}) puts "WARNING: No create record available for dyndns, you need to do so manually" end @@ -44,16 +44,15 @@ def destroy_host_record(opts={}) puts "WARNING: No destroy record available for dyndns, you need to do so manually" end def update_host_record(old_opts={}, new_opts={}) - old_opts = setup_opts(opts, [:host, :domain]) - new_opts = setup_opts(opts, [:data]) - - host = hostname(old_opts[:host]) + old_opts = setup_opts(old_opts, [:host, :domain]) + + host = "#{old_opts[:host]}.#{old_opts[:domain]}" ip = new_opts[:data] update_url = eval('%Q{' + @update_url + '}') - + # puts update_url # This header is required by dyndns.org headers = { "User-Agent" => "Capistrano - Rubber - 0.1" }