Class: Chef::Provider::ServerCollection
- Inherits:
-
Chef::Provider
- Object
- Chef::Provider
- Chef::Provider::ServerCollection
- Defined in:
- lib/chef/providers/server_collection_provider.rb
Overview
ServerCollection chef provider. Allows retrieving a set of servers by tags
Instance Method Summary collapse
-
#action_load ⇒ Object
Get the tagged servers synchronously.
-
#initialize(node, resource, collection = nil, definitions = {}, cookbook_loader = nil) ⇒ ServerCollection
constructor
Initialize condition variable used to synchronize chef and EM threads.
-
#load_current_resource ⇒ Object
This provider doesn’t actually change any state on the server.
Constructor Details
#initialize(node, resource, collection = nil, definitions = {}, cookbook_loader = nil) ⇒ ServerCollection
Initialize condition variable used to synchronize chef and EM threads
32 33 34 |
# File 'lib/chef/providers/server_collection_provider.rb', line 32 def initialize(node, resource, collection=nil, definitions={}, cookbook_loader=nil) super(node, resource) end |
Instance Method Details
#action_load ⇒ Object
Get the tagged servers synchronously
Return
- true
-
Always return true
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/chef/providers/server_collection_provider.rb', line 48 def action_load node.set[:server_collection] ||= {} node.set[:server_collection][@new_resource.name] = {} return unless @new_resource. && !@new_resource..empty? result = RightScale::Cook.instance.(@new_resource., @new_resource.agent_ids, @new_resource.timeout) collection = result.inject({}) { |res, (k, v)| res[k] = v['tags']; res } node.set[:server_collection][@new_resource.name] = collection true end |
#load_current_resource ⇒ Object
This provider doesn’t actually change any state on the server
Return
- true
-
Always return true
40 41 42 |
# File 'lib/chef/providers/server_collection_provider.rb', line 40 def load_current_resource true end |