Class: ChefInstance::Provider::Instance

Inherits:
Chef::Provider
  • Object
show all
Defined in:
lib/chef_instance/provider_instance.rb

Overview

Provides a Superclass Chef Provider to help with Factories.

Instance Method Summary collapse

Constructor Details

#initialize(new_resource, run_context = nil) ⇒ Instance

Construct a new ChefInstance::Provider::Instance.

Parameters:

  • new_resource (Chef::Resource)
  • run_context (Chef::RunContext) (defaults to: nil)


10
11
12
13
14
15
# File 'lib/chef_instance/provider_instance.rb', line 10

def initialize(new_resource, run_context = nil)
  super
  @new_resource = new_resource
  @run_context = run_context
  @namespace = @new_resource.namespace
end

Instance Method Details

#action_createObject

Installs the install_type Creates the service_type



29
30
31
32
# File 'lib/chef_instance/provider_instance.rb', line 29

def action_create
  instance(@new_resource.install_type, :install)
  instance(@new_resource.service_type, :create)
end

#action_destroyObject

Destroy the service_type Uninstall the install_type



36
37
# File 'lib/chef_instance/provider_instance.rb', line 36

def action_destroy
end

#action_disableObject

Disable the service_type



40
41
42
# File 'lib/chef_instance/provider_instance.rb', line 40

def action_disable
  instance(@new_resource.service_type, :disable)
end

#action_enableObject

Enable the service_type



45
46
47
# File 'lib/chef_instance/provider_instance.rb', line 45

def action_enable
  instance(@new_resource.service_type, :enable)
end

#load_current_resourceTrueClass

Determines the state of the resource currently

Returns:

  • (TrueClass)

    This must be overridden in subclasses.



24
25
# File 'lib/chef_instance/provider_instance.rb', line 24

def load_current_resource
end

#whyrun_supported?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/chef_instance/provider_instance.rb', line 18

def whyrun_supported?
  false
end