Skip to content

Commit

Permalink
support for MD5 checksum as they are provided by oracle. The checksum…
Browse files Browse the repository at this point in the history
… format is automatically detected.
  • Loading branch information
st-h committed Oct 27, 2013
1 parent b66959b commit b98851b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions providers/ark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ def parse_app_dir_name url
def oracle_downloaded?(download_path, new_resource)
if ::File.exists? download_path
require 'digest'
downloaded_sha = Digest::SHA256.file(download_path).hexdigest
downloaded_sha == new_resource.checksum
if new_resource.checksum =~ /^[0-9a-f]{32}$/
downloaded_sha = Digest::MD5.file(download_path).hexdigest
downloaded_sha == new_resource.md5
else
downloaded_sha = Digest::SHA256.file(download_path).hexdigest
downloaded_sha == new_resource.checksum
end
else
return false
end
Expand Down
2 changes: 1 addition & 1 deletion resources/ark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

attribute :url, :regex => /^(file|https?):\/\/.*(tar.gz|tgz|bin|zip)$/, :default => nil
attribute :mirrorlist, :kind_of => Array, :default => nil
attribute :checksum, :regex => /^[a-zA-Z0-9]{40,64}$/, :default => nil
attribute :checksum, :regex => /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, :default => nil
attribute :app_home, :kind_of => String, :default => nil
attribute :app_home_mode, :kind_of => Integer, :default => 0755
attribute :bin_cmds, :kind_of => Array, :default => nil
Expand Down

0 comments on commit b98851b

Please sign in to comment.