class Chef::Resource::WindowsPackage

Public Class Methods

new(name, run_context=nil) click to toggle source
Calls superclass method Chef::Resource::Package.new
# File lib/chef/resource/windows_package.rb, line 29
def initialize(name, run_context=nil)
  super
  @allowed_actions = [ :install, :remove ]
  @provider = Chef::Provider::Package::Windows
  @resource_name = :windows_package
  @source ||= source(@package_name)

  # Unique to this resource
  @installer_type = nil
  @timeout = 600
  # In the past we accepted return code 127 for an unknown reason and 42 because of a bug
  @returns = [ 0 ]
end

Public Instance Methods

installer_type(arg=nil) click to toggle source
# File lib/chef/resource/windows_package.rb, line 43
def installer_type(arg=nil)
  set_or_return(
    :installer_type,
    arg,
    :kind_of => [ String ]
  )
end
returns(arg=nil) click to toggle source
# File lib/chef/resource/windows_package.rb, line 59
def returns(arg=nil)
  set_or_return(
    :returns,
    arg,
    :kind_of => [ String, Integer, Array ]
  )
end
source(arg=nil) click to toggle source
# File lib/chef/resource/windows_package.rb, line 67
def source(arg=nil)
  if arg == nil && self.instance_variable_defined?(:@source) == true
    @source
  else
    raise ArgumentError, "Bad type for WindowsPackage resource, use a String" unless arg.is_a?(String)
    Chef::Log.debug("#{package_name}: sanitizing source path '#{arg}'")
    @source = ::File.absolute_path(arg).gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)
  end
end
timeout(arg=nil) click to toggle source
# File lib/chef/resource/windows_package.rb, line 51
def timeout(arg=nil)
  set_or_return(
    :timeout,
    arg,
    :kind_of => [ String, Integer ]
  )
end