    # File lib/chef/provider/package/rpm.rb, line 27
            def load_current_resource
              @current_resource = Chef::Resource::Package.new(@new_resource.name)
              @current_resource.package_name(@new_resource.package_name)
              @new_resource.version(nil)

              if @new_resource.source
                unless ::File.exists?(@new_resource.source)
                  raise Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}"
                end

                Chef::Log.debug("#{@new_resource} checking rpm status")
                status = popen4("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@new_resource.source}") do |pid, stdin, stdout, stderr|
                  stdout.each do |line|
                    case line
                    when /([\w\d_.-]+)\s([\w\d_.-]+)/
                      @current_resource.package_name($1)
                      @new_resource.version($2)
                    end
                  end
                end
              else
                if Array(@new_resource.action).include?(:install)
                  raise Chef::Exceptions::Package, "Source for package #{@new_resource.name} required for action install"
                end
              end

              Chef::Log.debug("#{@new_resource} checking install state")
              status = popen4("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@current_resource.package_name}") do |pid, stdin, stdout, stderr|
                stdout.each do |line|
                  case line
                  when /([\w\d_.-]+)\s([\w\d_.-]+)/
                    Chef::Log.debug("#{@new_resource} current version is #{$2}")
                    @current_resource.version($2)
                  end
                end
              end

              unless status.exitstatus == 0 || status.exitstatus == 1
                raise Chef::Exceptions::Package, "rpm failed - #{status.inspect}!"
              end

              @current_resource
            end