Permalink
Browse files

fix regex matching on classes

  • Loading branch information...
1 parent 645f8c1 commit 1dd4d646d5d674d779543343d11e9aa5b48864b8 @ripienaar committed Mar 8, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −6 connector/redis/discovery/redis.rb
@@ -79,19 +79,21 @@ def find_in_zlist(key_type, found, max_age, filter)
prefix = "mcollective::%s" % key_type
oldest = Time.now.utc.to_i - max_age
- agents = @redis.keys.grep(/^#{prefix}/).map do |key|
+ members = @redis.keys.grep(/^#{prefix}/).map do |key|
key.match(/^#{prefix}::(.+)$/)[1]
end
- filter.each do |matcher|
- matched = agents.grep(regexy_string(matcher))
+ discovered = []
- found << [] if matched.empty?
+ filter.each do |matcher|
+ matched = members.grep(regexy_string(matcher))
- matched.each do |agent|
- found << @redis.zrange("#{prefix}::#{agent}", 0, oldest)
+ matched.each do |member|
+ discovered.concat @redis.zrange("#{prefix}::#{member}", 0, oldest)
end
end
+
+ found << discovered
end
def collective_hostlist(collective, max_age)

0 comments on commit 1dd4d64

Please sign in to comment.