Class: Ridley::EnvironmentResource
- Defined in:
- lib/ridley/resources/environment_resource.rb
Instance Method Summary collapse
-
#cookbook_versions(environment, run_list = []) ⇒ Hash
Used to return a hash of the cookbooks and cookbook versions (including all dependencies) that are required by the run_list array.
-
#delete_all ⇒ Array<Ridley::EnvironmentObject>
Delete all of the environments on the client.
Methods inherited from Resource
#all, #connection, #create, #delete, #find, #initialize, #new, representation, represented_by, resource_path, set_resource_path, #update
Constructor Details
This class inherits a constructor from Ridley::Resource
Instance Method Details
#cookbook_versions(environment, run_list = []) ⇒ Hash
Used to return a hash of the cookbooks and cookbook versions (including all dependencies) that are required by the run_list array.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ridley/resources/environment_resource.rb', line 17 def cookbook_versions(environment, run_list = []) run_list = Array(run_list).flatten chef_id = environment.respond_to?(:chef_id) ? environment.chef_id : environment request(:post, "#{self.class.resource_path}/#{chef_id}/cookbook_versions", JSON.fast_generate(run_list: run_list)) rescue AbortError => ex if ex.cause.is_a?(Errors::HTTPNotFound) abort Errors::ResourceNotFound.new(ex) end abort(ex.cause) end |
#delete_all ⇒ Array<Ridley::EnvironmentObject>
Delete all of the environments on the client. The ‘_default’ environment will never be deleted.
32 33 34 35 |
# File 'lib/ridley/resources/environment_resource.rb', line 32 def delete_all envs = all.reject { |env| env.name.to_s == '_default' } envs.collect { |resource| future(:delete, resource) }.map(&:value) end |