diff --git a/Gemfile b/Gemfile index 7561f5b8..0c5643b4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,4 @@ source 'https://rubygems.org' -gem 'chef-vault', '~> 2.6' gem 'poise', '~> 2.2' gem 'poise-service', '~> 1.0' gem 'poise-boiler' @@ -10,6 +9,7 @@ group :lint do end group :unit, :integration do + gem 'chef-sugar' gem 'chefspec' gem 'berkshelf' gem 'serverspec' @@ -17,7 +17,7 @@ end group :development do gem 'awesome_print' - gem 'github_changelog_generator' +# gem 'github_changelog_generator' gem 'rake' gem 'stove' end diff --git a/libraries/consul_installation_webui.rb b/libraries/consul_installation_webui.rb index 01371a5f..8734566b 100644 --- a/libraries/consul_installation_webui.rb +++ b/libraries/consul_installation_webui.rb @@ -79,7 +79,7 @@ def self.default_archive_url "https://releases.hashicorp.com/consul/%{version}/%{basename}" # rubocop:disable Style/StringLiterals end - def self.binary_basename(node, resource) + def self.binary_basename(_node, resource) ['consul', resource.version, 'web_ui'].join('_').concat('.zip') end diff --git a/libraries/consul_service_windows.rb b/libraries/consul_service_windows.rb index 7083bafc..7f2db0c0 100644 --- a/libraries/consul_service_windows.rb +++ b/libraries/consul_service_windows.rb @@ -49,14 +49,14 @@ def action_enable end powershell_script 'Trigger consul restart' do action :nothing - code "restart-service consul" + code 'restart-service consul' end end # Check if the service is running, but don't bother if we're already # changing some nssm parameters unless nssm_service_status?(%w{SERVICE_RUNNING}) && mismatch_params.empty? powershell_script 'Trigger consul restart' do - code "restart-service consul" + code 'restart-service consul' end end end @@ -69,7 +69,7 @@ def action_reload def action_restart powershell_script 'Restart consul' do - code "restart-service consul" + code 'restart-service consul' end end @@ -78,7 +78,7 @@ def action_disable # nssm resource doesn't stop the service before it removes it powershell_script 'Stop consul' do action :run - code "stop-service consul" + code 'stop-service consul' only_if { nssm_service_installed? && nssm_service_status?(%w{SERVICE_RUNNING SERVICE_PAUSED}) } end diff --git a/metadata.rb b/metadata.rb index 472fdc5d..91bdf39d 100644 --- a/metadata.rb +++ b/metadata.rb @@ -19,7 +19,6 @@ depends 'build-essential' depends 'chef-sugar' -depends 'chef-vault', '~> 1.3' depends 'nssm' depends 'golang' depends 'firewall', '~> 2.0' diff --git a/test/cookbooks/consul_spec/recipes/consul_installation_webui.rb b/test/cookbooks/consul_spec/recipes/consul_installation_webui.rb new file mode 100644 index 00000000..b94ad3ed --- /dev/null +++ b/test/cookbooks/consul_spec/recipes/consul_installation_webui.rb @@ -0,0 +1 @@ +consul_installation 'webui' diff --git a/test/spec/libraries/consul_installation_webui_spec.rb b/test/spec/libraries/consul_installation_webui_spec.rb new file mode 100644 index 00000000..2b41f873 --- /dev/null +++ b/test/spec/libraries/consul_installation_webui_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' +require_relative '../../../libraries/consul_installation' + +describe ConsulCookbook::Resource::ConsulInstallation do + step_into(:consul_installation) + let(:chefspec_options) { {platform: 'ubuntu', version: '14.04'} } + + context 'consul ui install' do + recipe 'consul_spec::consul_installation_webui' + + it do is_expected.to unzip_zipfile('consul_0.6.4_web_ui.zip') + .with(owner: 'myconsul', + group: 'myconsul', + remote_url: 'https://releases.hashicorp.com/consul/0.5.1/consul_0.5.1_web_ui.zip', + install_path: '/opt') + end + end +end diff --git a/test/spec/libraries/consul_ui_spec.rb b/test/spec/libraries/consul_ui_spec.rb deleted file mode 100644 index 59cc4fdf..00000000 --- a/test/spec/libraries/consul_ui_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' -require_relative '../../../libraries/consul_ui' - -describe ConsulCookbook::Resource::ConsulUI do - step_into(:consul_ui) - let(:chefspec_options) { {platform: 'ubuntu', version: '14.04'} } - - context 'consul ui install' do - recipe 'consul_spec::consul_ui' - - it do is_expected.to create_libartifact_file('myconsul-ui-0.5.1') - .with(owner: 'myconsul', - group: 'myconsul', - remote_url: "https://releases.hashicorp.com/consul/0.5.1/consul_0.5.1_web_ui.zip", - install_path: '/opt') - end - end -end