pcorliss / ruby_route_53

Ruby gem and command line tool for Amazon's Route 53 service.
blog.50projects.com
GNU General Public License v3.0
172 stars 32 forks source link

cant create A record #19

Closed ghost closed 10 years ago

ghost commented 12 years ago

Hello I'm having some problem creating an A record with route53 the only example I have is with a CNAME and not sure if it works the same way but I keep getting:

var/lib/gems/1.9.1/gems/route53-0.2.1/lib/route53.rb:364:in create': undefined methodperform_actions' for "XXXmyinfoXXX":String (NoMethodError) from ./pf_zone-test.rb:22:in amazon' from ./pf_zone-test.rb:25:in

'

here is an example code strip down so you can review:

!/usr/bin/env ruby

require 'rubygems' require 'zonefile' require 'route53'

domain="mydomain.com" bindfile="named/zones/db.#{domain}" my_access_key="xxxxxxxxxxxxxx" my_secret_key="xxxxxxxxxxxxxxx"

conn = Route53::Connection.new(my_access_key,my_secret_key)

here only if we want to create a new zone, this works

new_zone = Route53::Zone.new("#{domain}",nil,conn)

resp = new_zone.create_zone

def amazon(type, record1, record2, domain) puts "#{type} #{record1} #{record2} #{domain}" new_record = Route53::DNSRecord.new("#{record1}","#{type}","600",["#{record2}"],domain ) resp = new_record.create end

amazon("A","new.mydomain.com","4.4.4.4","#{domain}")

hope you can help me on this im stuck.

cnet343 commented 12 years ago

Did you manage to figure this out?

ghost commented 12 years ago

nah I ended up coding my own ruby scripts to do this

willejs commented 12 years ago

Could you share your script please?did you just run the command line version of the gem? On Feb 17, 2012 9:42 PM, "Christian Fernandez" < reply@reply.github.com> wrote:

nah I ended up coding my own ruby scripts to do this


Reply to this email directly or view it on GitHub: https://github.com/pcorliss/ruby_route_53/issues/19#issuecomment-4028394

pcorliss commented 10 years ago

First off sorry for the long-long delay in getting to this. By now I'm sure you've found a way around this.

The error you're seeing is because the Route53::DNSRecord.new method expects a Route53::Zone object rather than a string for the last argument you can get a list of zone objects on your account via the following code and select the one that matches.

zones = conn.get_zones
zone = conn.get_zones.detect { |zone| zone.name.start_with? domain }
amazon("A","new.mydomain.com","4.4.4.4",zone)