Skip to content

Commit

Permalink
Merge 14b89fa into d96b787
Browse files Browse the repository at this point in the history
  • Loading branch information
ashley-abbott committed Apr 1, 2019
2 parents d96b787 + 14b89fa commit f5ab05e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -12,3 +12,4 @@ gem 'stove'
gem 'test-kitchen'
gem 'winrm'
gem 'winrm-fs'
gem 'ffi-libarchive'
6 changes: 3 additions & 3 deletions metadata.rb
Expand Up @@ -4,7 +4,7 @@
license 'Apache-2.0'
description 'Installs/Configures consul-template'
long_description 'Installs/Configures consul-template'
version '0.13.0'
version '0.14.0'

recipe 'consul-template', 'Installs, configures, and starts the consul-template service.'
recipe 'consul-template::install_binary', 'Installs consul-template from binary.'
Expand All @@ -17,11 +17,11 @@
supports 'arch'
supports 'windows'

depends 'libarchive'
depends 'libarchive', '>= 2.0.0'
depends 'golang'
depends 'runit'
depends 'nssm'

issues_url 'https://github.com/adamkrone/chef-consul-template/issues' if respond_to?(:issues_url)
source_url 'https://github.com/adamkrone/chef-consul-template' if respond_to?(:source_url)
chef_version '>= 12.1' if respond_to?(:chef_version)
chef_version '>= 14.0' if respond_to?(:chef_version)
28 changes: 20 additions & 8 deletions recipes/install_binary.rb
Expand Up @@ -7,7 +7,7 @@
#
#

include_recipe 'libarchive::default'
include_recipe 'libarchive::default' unless Chef::VERSION.to_i >= 14
require 'chef/version_constraint'

url = ::URI.join(node['consul_template']['base_url'],
Expand All @@ -23,15 +23,27 @@
action :create_if_missing
end

libarchive_file ConsulTemplateHelpers.install_file(node) do
path download_path
extract_to install_path
mode 0o755
not_if { File.exist? install_path }
action :extract
libarchive_version = run_context.cookbook_collection['libarchive'].version.to_f.round(2)
case libarchive_version
when 2.0
archive_file ConsulTemplateHelpers.install_file(node) do
path download_path
extract_to install_path
mode 0755
not_if { File.exist? install_path }
action :extract
end
when libarchive_version < 2.0
libarchive_file ConsulTemplateHelpers.install_file(node) do
path download_path
extract_to install_path
mode 0755
not_if { File.exist? install_path }
action :extract
end
end

link "#{node['consul_template']['install_dir']}/consul-template" do
to "#{install_path}/consul-template"
mode 0o755
mode 0755
end

0 comments on commit f5ab05e

Please sign in to comment.