in cookbooks/fb_storage/libraries/storage_handlers.rb [33:60]
def self.get_handler(device, node)
return @@handler_cache[device] if @@handler_cache[device]
devname = FB::Storage.device_name_from_path(device)
if node['block_device'][devname]
info = node['block_device'][devname].to_hash
else
Chef::Log.debug(
"fb_storage: #{devname} is not in node['block_device']",
)
info = {}
end
node['fb_storage']['_handlers'].each do |handler|
unless handler.superclass == FB::Storage::Handler
fail "fb_storage: handler #{handler.name} is not a subclass of " +
'FB::Storage::Handler, aborting!'
end
if handler.match?(devname, info)
Chef::Log.debug("fb_storage: Creating #{handler.name} handler")
obj = handler.new(device, node)
@@handler_cache[device] = obj
return obj
end
end
fail "fb_storage: unknown handler for device #{devname}"
end