diff --git a/.kitchen.yml b/.kitchen.yml index 71a218bc..87f12c86 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -47,9 +47,12 @@ suites: - recipe[consul::default] attributes: consul: - config: *default-config - installation: - provider: webui + config: + bootstrap: true + server: true + ui: true + datacenter: FortMeade + encrypt: CGXC2NsXW4AvuB4h5ODYzQ== excludes: - windows-2012r2 - name: acl @@ -84,17 +87,3 @@ suites: nssm_params: AppStdout: C:\foo\bar\out.log AppStderr: C:\foo\bar\err.log - # - name: atlas - # excludes: - # - windows-2012r2 - # run_list: - # - recipe[consul::default] - # attributes: - # consul: - # config: - # bootstrap: true - # server: true - # datacenter: fortmeade - # atlas_join: true - # atlas_infrastructure: <%= ENV.fetch('ATLAS_INFRASTRUCTURE', 'example/cluster') %> - # atlas_token: <%= ENV.fetch('ATLAS_TOKEN', 'NOT_REAL') %> diff --git a/libraries/consul_installation_webui.rb b/libraries/consul_installation_webui.rb deleted file mode 100644 index c6a47cbc..00000000 --- a/libraries/consul_installation_webui.rb +++ /dev/null @@ -1,104 +0,0 @@ -# -# Cookbook: consul -# License: Apache 2.0 -# -# Copyright 2014-2016, Bloomberg Finance L.P. -# -require 'poise' - -module ConsulCookbook - module Provider - # A `consul_installation` provider which manages Consul Web UI - # remote installation. - # @action create - # @action remove - # @provides consul_installation - # @example - # consul_installation '0.5.0' do - # provider 'webui' - # end - # @since 2.0 - class ConsulInstallationWebui < Chef::Provider - include Poise(inversion: :consul_installation) - provides(:webui) - inversion_attribute('consul') - - # Set the default inversion options. - # @return [Hash] - # @api private - def self.default_inversion_options(node, resource) - archive_basename = binary_basename(node, resource) - super.merge( - version: resource.version, - archive_url: default_archive_url % { version: resource.version, basename: archive_basename }, - archive_basename: archive_basename, - archive_checksum: binary_checksum(node, resource), - extract_to: '/opt/consul-webui' - ) - end - - def action_create - archive_url = options[:archive_url] % { - version: options[:version], - basename: options[:archive_basename] - } - - notifying_block do - include_recipe 'libarchive::default' - - 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 - - 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 - - def action_remove - notifying_block do - directory ::File.join(options[:extract_to], new_resource.version) do - recursive true - action :delete - end - end - end - - def consul_program - ::File.join(options[:extract_to], new_resource.version, 'consul') - end - - def self.default_archive_url - "https://releases.hashicorp.com/consul/%{version}/%{basename}" # rubocop:disable Style/StringLiterals - end - - def self.binary_basename(node, resource) - ['consul', resource.version, 'web_ui'].join('_').concat('zip') - end - - def self.binary_checksum(node, resource) - case resource.version - when '0.5.0' then '0081d08be9c0b1172939e92af5a7cf9ba4f90e54fae24a353299503b24bb8be9' - when '0.5.1' then 'ad883aa52e1c0136ab1492bbcedad1210235f26d59719fb6de3ef6464f1ff3b1' - when '0.5.2' then 'ad883aa52e1c0136ab1492bbcedad1210235f26d59719fb6de3ef6464f1ff3b1' - when '0.6.0' then '73c5e7ee50bb4a2efe56331d330e6d7dbf46335599c028344ccc4031c0c32eb0' - when '0.6.1' then 'afccdd540b166b778c7c0483becc5e282bbbb1ee52335bfe94bf757df8c55efc' - when '0.6.2' then 'f144377b8078df5a3f05918d167a52123089fc47b12fc978e6fb375ae93afc90' - when '0.6.3' then '93bbb300cacfe8de90fb3bd5ede7d37ae6ce014898edc520b9c96a676b2bbb72' - end - end - end - end -end diff --git a/libraries/consul_service.rb b/libraries/consul_service.rb index dc9aad28..38766b63 100644 --- a/libraries/consul_service.rb +++ b/libraries/consul_service.rb @@ -42,13 +42,13 @@ class ConsulService < Chef::Resource # @!attribute nssm_params # @return [String] attribute(:nssm_params, kind_of: Hash, default: lazy { node['consul']['service']['nssm_params'] }) - # @!attribute consul_binary + # @!attribute program # The location of the Consul executable. # @return [String] attribute(:program, kind_of: String, default: '/usr/local/bin/consul') def command - "#{consul_binary} agent -config-file=#{config_file} -config-dir=#{config_dir}" + "#{program} agent -config-file=#{config_file} -config-dir=#{config_dir}" end def default_environment