Skip to content

Commit

Permalink
Update cookbook to use zipfile resource.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Bellone committed Mar 17, 2016
1 parent 753397b commit 28c19e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
24 changes: 3 additions & 21 deletions libraries/consul_installation_binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,16 @@ def action_create
}

notifying_block do
archive = remote_file options[:archive_basename] do
path ::File.join(Chef::Config[:file_cache_path], name)
source archive_url
checksum options[:archive_checksum]
end

directory ::File.join(options[:extract_to], new_resource.version) do
recursive true
end

windows_zipfile options[:archive_basename] do
zipfile options[:archive_basename] do
path ::File.join(options[:extract_to], new_resource.version)
source archive.path
only_if { node.platform?('windows') }
source archive_url
checksum options[:archive_checksum]
not_if { ::File.exist?(consul_program) }
end

unless node.platform?('windows')
include_recipe 'libarchive::default'
libarchive_file options[:archive_basename] do
path archive.path
mode options[:extract_mode]
owner options[:extract_owner]
group options[:extract_group]
extract_to ::File.join(options[:extract_to], new_resource.version)
extract_options options[:extract_options]
end
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
depends 'nssm'
depends 'golang'
depends 'firewall', '~> 2.0'
depends 'libartifact', '~> 1.3'
depends 'poise', '~> 2.2'
depends 'poise-service', '~> 1.0'
depends 'rubyzip', '~> 1.0'
depends 'yum-epel'

source_url 'https://github.com/johnbellone/consul-cookbook' if respond_to?(:source_url)
Expand Down

0 comments on commit 28c19e7

Please sign in to comment.