JSON.parse() can't convert RestClient::Response into String
Opened this issue · 0 comments
For some reason Chef's dynect cookbook returns a RestClient::Response when get()'ing resources from Dynect. This can be seen by running this recipe: https://github.com/opscode/cookbooks/blob/master/dynect/recipes/ec2.rb Which will fail with a fatal error:
[Tue, 21 Jun 2011 00:17:19 +0000] FATAL: TypeError: dynect_rr[i-8bd180e5] (dynect::ec2 line 23) had an error: can't convert RestClient::Response into String
However, the same code in ruby seems to work OK:
require 'rubygems' require 'dynect_rest' res = 'i-8bd180e5.example.com' dyn = DynectRest.new("example", "me", "xxx", "example.com") DynectRest::Resource.new(dyn, 'CNAMERecord', 'example.com').get(res)
I'm not entirely sure this is an error with the cookbook, so I'm opening an issue here for the dynect_rest library. The fix is to send the response_body to JSON.parse() with .to_s. Patch inbound.