dynect_rest
dynect_rest copied to clipboard
Fix for 'find' method
In the 'find' method, get(fqdn) is expected to return an Array, however if only one record is found it returns Dynect::Resource object (line 85-86 in resource.rb). In this case 'find' would throw a NoMethodError: undefined method `each' for DynectRest::Resource exception.
Thanks for writing this, it has been invaluable in helping me automate my infrastructure.
@jghward you can avoid the [] and flatten call by directly passing the get call to Array
Array(get(fqdn)).each