Class: Chef::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/container.rb

Instance Method Summary collapse

Instance Method Details

#container_init(name, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/chef/container.rb', line 6

def container_init(name, &block)
  begin
    # Find the corresponding `service` resource and override the provider
    @service_resource = resources("service[#{name}]")
    @orig_provider = @service_resource.provider
    @service_resource.provider = Chef::Provider::Service::ChefContainer
  rescue Chef::Exceptions::ResourceNotFound => e
    Chef::Log.info "Resource service[#{@service_name}] not found."
    raise e
  else
    # other exception
  ensure
    # always executed
  end
end