Skip to content

With ruby-2.0.0-p247 and builder-3.2.2 in file lib/route53.rb:348 @values is a String, but an Array is expected #32

Description

@DevoKun

Code Usage

puts "       *** generating DNSRecord Object"
new_record = Route53::DNSRecord.new(fqdn, type, ttl, target, zone)
puts "       *** Creating Record using DNSRecord Object"
new_record.create

Console Output

       *** generating DNSRecord Object
           **** FQDN..: [hostname.mydomain.com.] (String)
           **** TTL...: [300] (String)
           **** Type..: [CNAME] (String)
           **** Target: [ec2-x-x-x-x.compute-1.amazonaws.com] (String)
       *** Creating Record using DNSRecord Object

Errors Produced during new_record.create

~/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:348:in `block (3 levels) in gen_change_xml': undefined method `each' for "ec2-x-x-x-x.compute-1.amazonaws.com":String (NoMethodError)
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:347:in `block (2 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:335:in `block in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:333:in `gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:214:in `block (4 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:213:in `each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:213:in `block (3 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:212:in `block (2 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:210:in `block in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:209:in `gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:225:in `perform_actions'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:364:in `create'
    from ./aws_r53_update_zones.rb:49:in `aws_r53_create_record'
    from ./aws_r53_update_zones.rb:87:in `aws_r53_update_record'
    from ./aws_r53_update_zones.rb:208:in `block in update_r53_for_account'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/ec2/instance_collection.rb:290:in `block (2 levels) in each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:97:in `block in method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/ec2/instance_collection.rb:289:in `block in each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:97:in `block in method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/ec2/instance_collection.rb:288:in `each'
    from ./aws_r53_update_zones.rb:126:in `update_r53_for_account'
    from ./aws_r53_update_zones.rb:279:in `block in '
    from ./aws_r53_update_zones.rb:269:in `each'
    from ./aws_r53_update_zones.rb:269:in `'

Patch

--- route53.rb  2013-11-18 08:21:04.015019761 -0500
+++ route53.rb  2013-11-18 08:21:04.015019761 -0500
@@ -345,6 +345,10 @@
             }
           else
             record.ResourceRecords { |resources|
+            ### DPH - Accomodate Ruby-2+Builder-3.2.2 Returning a String instead of Array
+            ###       Ruby-1.8/1.9+Builder-x Returned an Array, so probably need this hack
+            ###       for backward compatibiltiy?
+            puts "\nDEBUG: @values ["+@values.class.to_s+"]\n"
+            if (@values.class.to_s == "String") then @values = [@values] end
+            ### / DPH
               @values.each { |val|
                 resources.ResourceRecord { |record|
                   record.Value(val)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions