Method: Chef::Provider::Package::Dpkg#load_current_resource

Defined in:
lib/chef/provider/package/dpkg.rb

#load_current_resourceObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/chef/provider/package/dpkg.rb', line 52

def load_current_resource
  @current_resource = Chef::Resource::Package.new(new_resource.name)
  current_resource.package_name(new_resource.package_name)

  if source_files_exist?
    @candidate_version = get_candidate_version
    current_resource.package_name(get_package_name)
    # if the source file exists then our package_name is right
    current_resource.version(get_current_version_from(current_package_name_array))
  elsif !installing?
    # we can't do this if we're installing with no source, because our package_name
    # is probably not right.
    #
    # if we're removing or purging we don't use source, and our package_name must
    # be right so we can do this.
    #
    # we don't error here on the dpkg command since we'll handle the exception or
    # the why-run message in define_resource_requirements.
    current_resource.version(get_current_version_from(current_package_name_array))
  end

  current_resource
end