mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
dynect: nicer filter api for records
This commit is contained in:
parent
f47e4c8af0
commit
a772360de7
2 changed files with 4 additions and 4 deletions
|
@ -11,11 +11,11 @@ module Fog
|
|||
|
||||
model Fog::Dynect::DNS::Record
|
||||
|
||||
def all(attributes={})
|
||||
def all(filter=nil)
|
||||
selected_nodes = nodes
|
||||
selected_nodes = nodes.select do |node|
|
||||
Array(attributes[:nodes]).include?(node)
|
||||
end if attributes[:nodes]
|
||||
node =~ /#{Regexp.escape(filter)}$/
|
||||
end if filter
|
||||
|
||||
data = selected_nodes.inject([]) do |m, node|
|
||||
m += connection.list_any_records(zone.id, node).map(&:body)
|
||||
|
|
|
@ -41,7 +41,7 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
|
|||
end
|
||||
|
||||
tests "model" do
|
||||
records = Fog::DNS.new(:provider => "Dynect").zones.get(zone).records.all(:nodes => fqdn)
|
||||
records = Fog::DNS.new(:provider => "Dynect").zones.get(zone).records.all(fqdn)
|
||||
returns("127.0.0.2") { records.last.value }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue