oneops-admin/lib/shared/cookbooks/artifact/providers/file.rb
def checksum_valid?
  require 'digest'

  Chef::Log.info "Validating the checkum"

  if new_resource.checksum.to_s==''
    Chef::Log.info "Skipping as no checksum is provided"
    return true
  end

  if Chef::Artifact.from_nexus?(new_resource.location)
    Digest::SHA1.file(new_resource.name).hexdigest == Chef::Artifact.get_artifact_sha(node, new_resource.location)
  else
    if new_resource.checksum
      Digest::SHA1.file(new_resource.name).hexdigest == new_resource.checksum
    else
      Chef::Log.info "[artifact_file] No checksum provided for artifact_file, not verifying against downloaded file."
      true
    end
  end
end
# For a Nexus artifact, checks the downloaded file's SHA1 checksum
# against the Nexus Server's entry for the file. For normal HTTP artifact,
# check the passed through checksum or just assume the file is fine.
#
# @return [Boolean] true if the downloaded file's checksum
#   matches the checksum on record, false otherwise.
For a Nexus artifact, checks the downloaded file's SHA1 checksum
against the Nexus Server's entry for the file. For normal HTTP artifact,
check the passed through checksum or just assume the file is fine.
For a Nexus artifact checks the downloaded file ' s SHA1 checksum against the Nexus Server ' s entry for the file . For normal HTTP artifact check the passed through checksum or just assume the file is fine .
def checksum_valid?
  require 'digest'
  Chef::Log.info "Validating the checkum"
  if new_resource.checksum.to_s==''
    Chef::Log.info "Skipping as no checksum is provided"
    return true
  end
  if Chef::Artifact.from_nexus?(new_resource.location)
    Digest::SHA1.file(new_resource.name).hexdigest == Chef::Artifact.get_artifact_sha(node, new_resource.location)
  else
    if new_resource.checksum
      Digest::SHA1.file(new_resource.name).hexdigest == new_resource.checksum
    else
      Chef::Log.info "[artifact_file] No checksum provided for artifact_file, not verifying against downloaded file."
      true
    end
  end
end
def checksum_valid? require 'digest' Chef :: Log . info "Validating the checkum" if new_resource . checksum . to_s == '' Chef :: Log . info "Skipping as no checksum is provided" return true end if Chef :: Artifact . from_nexus? ( new_resource . location ) Digest :: SHA1 . file ( new_resource . name ) . hexdigest == Chef :: Artifact . get_artifact_sha ( node , new_resource . location ) else if new_resource . checksum Digest :: SHA1 . file ( new_resource . name ) . hexdigest == new_resource . checksum else Chef :: Log . info "[artifact_file] No checksum provided for artifact_file, not verifying against downloaded file." true end end end
For a Nexus artifact, checks the downloaded file's SHA1 checksum
against the Nexus Server's entry for the file.
For a Nexus artifact checks the downloaded file ' s SHA1 checksum against the Nexus Server ' s entry for the file .
true if the downloaded file's checksum matches the checksum on record, false otherwise.
true if the downloaded file ' s checksum matches the checksum on record false otherwise .
Boolean