Class: ChefInstance::Resource::Instance
- Inherits:
-
Chef::Resource
- Object
- Chef::Resource
- ChefInstance::Resource::Instance
- Defined in:
- lib/chef_instance/resource_instance.rb
Overview
Provides a Superclass Chef Resource to help with Factories.
Instance Method Summary collapse
-
#initialize(new_resource, run_context = nil) ⇒ Instance
constructor
Construct a new ChefInstance::Resource::Instance.
-
#install_options(arg = nil) ⇒ Object
A hash passed to the install type.
-
#install_type(arg = nil) ⇒ Object
The type of installation you are doing.
-
#namespace(arg = nil) ⇒ Object
Provide the namespace for lookups.
-
#service_options(arg = nil) ⇒ Object
A hash passed to the service type.
-
#service_type(arg = nil) ⇒ Object
The type of service manager you are using.
Constructor Details
#initialize(new_resource, run_context = nil) ⇒ Instance
Construct a new ChefInstance::Resource::Instance.
10 11 12 13 14 15 |
# File 'lib/chef_instance/resource_instance.rb', line 10 def initialize(new_resource, run_context = nil) super @provider = ChefInstance::Provider::Instance @action = :create @allowed_actions = [:create, :destroy, :enable, :disable, :nothing] end |
Instance Method Details
#install_options(arg = nil) ⇒ Object
A hash passed to the install type. Used to pass end-user overrides to the installer.
20 21 22 |
# File 'lib/chef_instance/resource_instance.rb', line 20 def (arg = nil) set_or_return(:install_options, arg, kind_of: Hash) end |
#install_type(arg = nil) ⇒ Object
The type of installation you are doing.
26 27 28 29 30 31 32 |
# File 'lib/chef_instance/resource_instance.rb', line 26 def install_type(arg = nil) set_or_return(:install_type, arg, kind_of: [Symbol], required: true, equal_to: [:package, :existing]) end |
#namespace(arg = nil) ⇒ Object
Provide the namespace for lookups.
Because the provider subclasses Chef::Provider
Its self.class
points us in the wrong direction.
55 56 57 58 59 60 |
# File 'lib/chef_instance/resource_instance.rb', line 55 def namespace(arg = nil) set_or_return(:namespace, arg, kind_of: String, default: 'ChefInstance') end |
#service_options(arg = nil) ⇒ Object
A hash passed to the service type. Used to pass end-user overrides to the service.
37 38 39 |
# File 'lib/chef_instance/resource_instance.rb', line 37 def (arg = nil) set_or_return(:service_options, arg, kind_of: Hash) end |
#service_type(arg = nil) ⇒ Object
The type of service manager you are using.
43 44 45 46 47 48 49 |
# File 'lib/chef_instance/resource_instance.rb', line 43 def service_type(arg = nil) set_or_return(:service_type, arg, kind_of: Symbol, required: true, equal_to: [:init, :runit]) end |