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

ipaddress gem breaks aws-sdk RESTXMLClient #49

Closed
garo opened this issue Aug 14, 2014 · 6 comments
Closed

ipaddress gem breaks aws-sdk RESTXMLClient #49

garo opened this issue Aug 14, 2014 · 6 comments
Assignees

Comments

@garo
Copy link

garo commented Aug 14, 2014

ipaddress is used with the Chef Ohai component, which caused a really bizarre problem: When aws-sdk (1.51.0, the newest atm) is used to do a create_health_check request it can't correctly send xml property named "IPAddress" to the aws api.

How to reproduce with irb:

require 'ipaddress'
require 'aws-sdk'
r53 = AWS::Route53.new(:access_key_id => "....",:secret_access_key => "...",:http_wire_trace => true)
options = {:caller_reference => "foo",:health_check_config => {:ip_address => "54.84.217.101",:type => "HTTP",:resource_path => "/check"}}
r53.client.create_health_check(options)

This prints that the following data is sent to the api:
"<CreateHealthCheckRequest xmlns=\"https://route53.amazonaws.com/doc/2013-04-01/\">\n <CallerReference>foo</CallerReference>\n <HealthCheckConfig>\n <Type>HTTP</Type>\n <ResourcePath>/check</ResourcePath>\n </HealthCheckConfig>\n</CreateHealthCheckRequest>"
(notice that there's no <IPAddress>54.84.217.101</IPAddress> tag)

Now another irb session without ipaddress gem:

require 'aws-sdk'
r53 = AWS::Route53.new(:access_key_id => "....",:secret_access_key => "...",:http_wire_trace => true)
options = {:caller_reference => "foo",:health_check_config => {:ip_address => "54.84.217.101",:type => "HTTP",:resource_path => "/check"}}
r53.client.create_health_check(options)

prints:
"<CreateHealthCheckRequest xmlns=\"https://route53.amazonaws.com/doc/2013-04-01/\">\n <CallerReference>foo</CallerReference>\n <HealthCheckConfig>\n <IPAddress>54.84.217.101</IPAddress>\n <Type>HTTP</Type>\n <ResourcePath>/check</ResourcePath>\n </HealthCheckConfig>\n</CreateHealthCheckRequest>"

So the ipaddress module is somehow monkey-patching something which breaks the aws-cli. the aws-cli builds the requests based on a yaml config which maps ruby property names into xml tags. Editing this yml and replacing the "IPAddress" tag definition with another name, say "IPAddress2" will result that the tag is rendered correctly.

There's at least one other user who was struct with this very same bug: https://forums.aws.amazon.com/thread.jspa?threadID=128785

@garo
Copy link
Author

garo commented Aug 14, 2014

Unfortunately the reproduction needs AWS access keys which I can't obviously give here :(

@bluemonk
Copy link
Collaborator

Thanks for the bug report. One of the goals of IPAddress 1.0 is to remove all monkey patching. There's not much but I definitely want to clean up the code.

I'll let you know when master is updated so you can check if the bug is still there.

@mikemackintosh
Copy link
Collaborator

@garo can you confirm if this happens with AWS-SDK v2 which was released last month?

@mikemackintosh
Copy link
Collaborator

This one will be tricky. There is no sandbox env for Route53, so the only way to test API calls is to purchase a subscription, etc.

I was hoping to use pry to get the http request sent from the sdk to the server to see exactly where the issue originates from. What Ruby version are you using, 1.8 by any chance?

@mikemackintosh mikemackintosh self-assigned this Mar 24, 2015
@sandstrom
Copy link
Collaborator

@bluemonk The monkey-patching you are mentioning here, is that something you want to add to the 1.0 checklist?

I've added a meta issue where we can track things we want to fix before 1.0:
#132

@sandstrom
Copy link
Collaborator

I think this may be the monkey patch causing this: #140

It's on it's way out. Closing this issue. Let me know if you don't think this is the fix.

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

No branches or pull requests

4 participants