Class: ChefInstance::Install::Package

Inherits:
Template
  • Object
show all
Defined in:
lib/chef_instance/install/package.rb

Overview

A Superclass template for installing packages.

Instance Method Summary collapse

Constructor Details

#initialize(new_resource, run_context = nil) ⇒ Package

Construct a new ChefInstance::Install::Package.

Parameters:

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


11
12
13
# File 'lib/chef_instance/install/package.rb', line 11

def initialize(new_resource, run_context = nil)
  super
end

Instance Method Details

#installObject

Installs a package.

  • Sets up a memoized [Chef::Resource::Package]
  • Passes install_options to the memoized resource.
  • Performs a run_action(:install) on the resource.


20
21
22
23
24
# File 'lib/chef_instance/install/package.rb', line 20

def install
  package_resource
  package_options
  package_action(:install)
end

#uninstallObject

Uninstalls a package.

  • Sets up a memoized [Chef::Resource::Package]
  • Performs a run_action(:remove) on the resource.


30
31
32
33
34
# File 'lib/chef_instance/install/package.rb', line 30

def uninstall
  package_resource
  package_options
  package_action(:remove)
end