Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DevoKun opened this issue Nov 18, 2013 · 2 comments
Labels

Comments

@DevoKun
Copy link

DevoKun commented Nov 18, 2013

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)
@pcorliss
Copy link
Owner

Looks okay to me, can you make the appropriate changes minus the debug statements and issue a pull request.

@pcorliss
Copy link
Owner

Per discussion in #33 this is actually an issue where the client is sending a string to values (or target) in the example above where the code expects an array. Marking as feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants