From 33368adbed90b4c6217a331ee43fbd0c82bda3f6 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 16:25:01 -0700 Subject: [PATCH 01/22] Use standardized license name --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 55898f2..2a7ccb7 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ name 'kibana' maintainer 'Peter Donald' maintainer_email 'peter@realityforge.org' -license 'Apache 2.0' +license 'Apache-2.0' description 'Installs/Configures kibana, the logstash UI' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.2.1' From 2dc3bbeee532b2b85d58dd6410aa8b9d01f42f33 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 16:25:30 -0700 Subject: [PATCH 02/22] enforce chef 12+ bump chef version to 12.7 --- Vagrantfile | 2 +- metadata.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 5252ca3..9f9a91f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -15,7 +15,7 @@ Vagrant.configure("2") do |config| # doesn't already exist on the user's system. config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box" - config.omnibus.chef_version = '11.6.2' + config.omnibus.chef_version = '12.7.2' # Assign this VM to a host-only network IP, allowing you to access it # via the IP. Host-only networks can talk to the host machine as well as diff --git a/metadata.rb b/metadata.rb index 2a7ccb7..ea24d29 100644 --- a/metadata.rb +++ b/metadata.rb @@ -11,6 +11,8 @@ source_url 'https://github.com/realityforge/chef-kibana' issues_url 'https://github.com/realityforge/chef-kibana/issues' +chef_version '>= 12' if respond_to?(:chef_version) + supports 'ubuntu' supports 'debian' From 7ad310eedbc78b8abeb2e6c4fda0607d815a3dbf Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 20:42:02 -0700 Subject: [PATCH 03/22] allow newer versions of ark --- Berksfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Berksfile b/Berksfile index d0a8214..304e223 100644 --- a/Berksfile +++ b/Berksfile @@ -3,7 +3,7 @@ source 'https://supermarket.chef.io/' metadata group :vagrant do - cookbook 'ark', '= 2.2.1' + cookbook 'ark', '>= 2.2.1' cookbook 'apt' cookbook 'apache2' cookbook 'elasticsearch', '~ 2.4.0' From f1e46aca153ba20ca56a9ed2442194a848ad2b83 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 20:49:13 -0700 Subject: [PATCH 04/22] declare centos support --- metadata.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/metadata.rb b/metadata.rb index ea24d29..ddcf7ce 100644 --- a/metadata.rb +++ b/metadata.rb @@ -15,6 +15,7 @@ supports 'ubuntu' supports 'debian' +supports 'centos' depends 'build-essential' depends 'ark' From d28135107c05ae844a6f259bdaf8b69bad1ae8c7 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 20:49:24 -0700 Subject: [PATCH 05/22] use more recent ruby 2.3.5 --- .ruby-version | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index a831048..829664e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.3.0 +ruby-2.3.5 diff --git a/.travis.yml b/.travis.yml index 2d32be3..fafb7e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: - - 2.3.0 + - 2.3.5 sudo: required services: docker From 7956ddf75ee1bbe19491e1adf1a2372ea086aed4 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 20:49:45 -0700 Subject: [PATCH 06/22] Add 0.2.2 notes --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 981ff98..31b4644 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.2.2: +* Update to fix travis runs for CentOS7 and Ubuntu 16.04. #102 (@drenalin23) +* Update `ark` #103 (@drenalin23) +* `kibana_plugin` resource to manage plugins #106 (@InformatiQ) +* Kibana5, Amazon Linux fixes #107 (@InformatiQ) +* switch `node['kibana']['version']` to integer #109 (@InformatiQ) +* Lint fixes #104 (@drenalin23) + ## 0.2.1: * fix issue with bin_path for package installs (@drenalin23) * update the nginx source attribute so it is easier to override in wrapper cookbooks (@drenalin23) From 122756cc9306a23a7bb540630f8b66a266219541 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 20:51:11 -0700 Subject: [PATCH 07/22] apply rubocop rules --- .rubocop.yml | 6 +++++ Berksfile | 18 +++++++------ Gemfile | 12 +++++---- Rakefile | 3 +-- Vagrantfile | 26 ++++++++++--------- attributes/default.rb | 1 - libraries/version.rb | 1 - metadata.rb | 1 - recipes/_service.rb | 3 +-- recipes/apache.rb | 1 - recipes/default.rb | 1 - recipes/kibana3.rb | 1 - recipes/kibana4.rb | 3 +-- recipes/kibana5.rb | 4 +-- recipes/nginx.rb | 2 +- resources/plugin.rb | 8 +++--- spec/support/matchers.rb | 1 + .../kibana3_apache/serverspec/default_spec.rb | 2 +- .../kibana3_apache/serverspec/spec_helper.rb | 2 +- .../kibana3_nginx/serverspec/default_spec.rb | 2 +- .../kibana3_nginx/serverspec/spec_helper.rb | 2 +- .../kibana3_source/serverspec/default_spec.rb | 2 +- .../kibana3_source/serverspec/spec_helper.rb | 2 +- .../kibana4_apache/serverspec/default_spec.rb | 2 +- .../kibana4_apache/serverspec/spec_helper.rb | 2 +- .../kibana4_nginx/serverspec/default_spec.rb | 2 +- .../kibana4_nginx/serverspec/spec_helper.rb | 2 +- test/unit/spec/_service_spec.rb | 1 + test/unit/spec/apache_spec.rb | 1 + test/unit/spec/default_spec.rb | 1 + test/unit/spec/kibana3_spec.rb | 1 + test/unit/spec/kibana4_spec.rb | 1 + test/unit/spec/nginx_spec.rb | 1 + test/unit/spec/spec_helper.rb | 2 +- 34 files changed, 66 insertions(+), 54 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 4f81136..2a6481f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,3 +17,9 @@ LeadingCommentSpace: LineLength: Enabled: false + +Style/FileName: + Exclude: + - 'Berksfile' + - 'Gemfile' + - 'Vagrantfile' diff --git a/Berksfile b/Berksfile index 304e223..adbadf4 100644 --- a/Berksfile +++ b/Berksfile @@ -1,14 +1,16 @@ +# frozen_string_literal: true + source 'https://supermarket.chef.io/' metadata group :vagrant do - cookbook 'ark', '>= 2.2.1' - cookbook 'apt' - cookbook 'apache2' - cookbook 'elasticsearch', '~ 2.4.0' - cookbook 'java' - cookbook 'ohai' - cookbook 'netstat' - cookbook 'chef_nginx', '~ 2.9.0' + cookbook 'ark', '>= 2.2.1' + cookbook 'apt' + cookbook 'apache2' + cookbook 'elasticsearch', '~ 2.4.0' + cookbook 'java' + cookbook 'ohai' + cookbook 'netstat' + cookbook 'chef_nginx', '~ 2.9.0' end diff --git a/Gemfile b/Gemfile index 2a64e3a..02830fd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,17 @@ +# frozen_string_literal: true + source 'https://rubygems.org' gem 'berkshelf' gem 'stove' group :test do - gem 'rake' - gem 'test-kitchen' + gem 'buff-extensions' + gem 'chefspec' gem 'foodcritic' + gem 'rake' gem 'rubocop' - gem 'chefspec' - gem 'buff-extensions' + gem 'test-kitchen' end group :vagrant do @@ -17,9 +19,9 @@ group :vagrant do end group :development do - gem 'knife-cookbook-doc' gem 'kitchen-openstack' gem 'kitchen-transport-rsync' + gem 'knife-cookbook-doc' end group :integration_docker do diff --git a/Rakefile b/Rakefile index 72617a9..ccf6ee9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true require 'rake' @@ -50,4 +49,4 @@ RSpec::Core::RakeTask.new(:unit) do |t| t.pattern = 'test/unit/spec/*_spec.rb' end -task default: [:rubocop, :foodcritic, :unit] +task default: %i[rubocop foodcritic unit] diff --git a/Vagrantfile b/Vagrantfile index 9f9a91f..1afdaba 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,19 +1,21 @@ +# frozen_string_literal: true + # -*- mode: ruby -*- # vi: set ft=ruby : -Vagrant.configure("2") do |config| +Vagrant.configure('2') do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, # please see the online documentation at vagrantup.com. - config.vm.hostname = "kibana" + config.vm.hostname = 'kibana' # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "opscode-precise64" + config.vm.box = 'opscode-precise64' # The url from where the 'config.vm.box' box will be fetched if it # doesn't already exist on the user's system. - config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box" + config.vm.box_url = 'https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box' config.omnibus.chef_version = '12.7.2' @@ -21,7 +23,7 @@ Vagrant.configure("2") do |config| # via the IP. Host-only networks can talk to the host machine as well as # any other machines on the same network, but cannot be accessed (through this # network interface) by any external networks. - config.vm.network :private_network, ip: "33.33.33.10" + config.vm.network :private_network, ip: '33.33.33.10' # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on @@ -57,7 +59,7 @@ Vagrant.configure("2") do |config| # information on available options. # The path to the Berksfile to use with Vagrant Berkshelf - config.berkshelf.berksfile_path = "./Berksfile" + config.berkshelf.berksfile_path = './Berksfile' # Enabling the Berkshelf plugin. To enable this globally, add this configuration # option to your ~/.vagrant.d/Vagrantfile file @@ -73,17 +75,17 @@ Vagrant.configure("2") do |config| config.vm.provision :chef_solo do |chef| chef.json = { - "kibana" => { - "apache" => { - "basic_auth" => 'on' + 'kibana' => { + 'apache' => { + 'basic_auth' => 'on' } } } chef.run_list = [ - "recipe[apt::default]", - "recipe[kibana::default]", - "recipe[kibana::apache]" + 'recipe[apt::default]', + 'recipe[kibana::default]', + 'recipe[kibana::apache]' ] end end diff --git a/attributes/default.rb b/attributes/default.rb index 008d8e9..61a45ec 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true #<> Kibana major version diff --git a/libraries/version.rb b/libraries/version.rb index ded4b66..64c2f5e 100644 --- a/libraries/version.rb +++ b/libraries/version.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true class Kibana diff --git a/metadata.rb b/metadata.rb index ddcf7ce..c0837e3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true name 'kibana' diff --git a/recipes/_service.rb b/recipes/_service.rb index e9716a4..cb0cb01 100644 --- a/recipes/_service.rb +++ b/recipes/_service.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true template node['kibana']['service']['template_file'] do @@ -17,5 +16,5 @@ service 'kibana' do provider node['kibana']['service']['provider'] supports start: true, restart: true, stop: true, status: true - action [:enable, :start] + action %i[enable start] end diff --git a/recipes/apache.rb b/recipes/apache.rb index 06f603f..bd76d19 100644 --- a/recipes/apache.rb +++ b/recipes/apache.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true =begin diff --git a/recipes/default.rb b/recipes/default.rb index 54f5109..53c37b1 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true =begin diff --git a/recipes/kibana3.rb b/recipes/kibana3.rb index a549aee..aa34c7e 100644 --- a/recipes/kibana3.rb +++ b/recipes/kibana3.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true include_recipe 'kibana' diff --git a/recipes/kibana4.rb b/recipes/kibana4.rb index a011cd5..705b7f2 100644 --- a/recipes/kibana4.rb +++ b/recipes/kibana4.rb @@ -1,4 +1,3 @@ -# Encoding: utf-8 # frozen_string_literal: true include_recipe 'kibana' @@ -19,7 +18,7 @@ apt_repository 'kibana' do uri node['kibana']['repository_url'] distribution '' - components %w(stable main) + components %w[stable main] key node['kibana']['repository_key'] end else diff --git a/recipes/kibana5.rb b/recipes/kibana5.rb index f277873..4232e16 100644 --- a/recipes/kibana5.rb +++ b/recipes/kibana5.rb @@ -1,4 +1,4 @@ -# Encoding: utf-8 +# frozen_string_literal: true include_recipe 'kibana' @@ -18,7 +18,7 @@ apt_repository 'kibana' do uri node['kibana']['repository_url'] distribution '' - components %w(stable main) + components %w[stable main] key node['kibana']['repository_key'] end else diff --git a/recipes/nginx.rb b/recipes/nginx.rb index 9e7e625..a461d7d 100644 --- a/recipes/nginx.rb +++ b/recipes/nginx.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + include_recipe 'chef_nginx' template File.join(node['nginx']['dir'], 'sites-available', 'kibana') do diff --git a/resources/plugin.rb b/resources/plugin.rb index 3c1d287..29538d2 100644 --- a/resources/plugin.rb +++ b/resources/plugin.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + resource_name :kibana_plugin property :name, String, name_property: true @@ -17,7 +19,7 @@ def plugin_exists?(name) list_arg = node['kibana']['version'] > 4 ? 'bin/kibana-plugin list' : 'bin/kibana plugin -l' - cmd_line = "#{list_arg}" + cmd_line = list_arg.to_s cmd = Mixlib::ShellOut.new(cmd_line, cwd: kibana_home) cmd.run_command cmd.stdout.include? name @@ -36,7 +38,7 @@ def update_plugin_reg(action) action :install do install_arg = node['kibana']['version'] > 4 ? "bin/kibana-plugin install #{url}" : "bin/kibana plugin -i #{name} -u #{url}" - plugin_install = "#{install_arg}" + plugin_install = install_arg.to_s execute 'plugin-install' do cwd kibana_home command plugin_install @@ -47,7 +49,7 @@ def update_plugin_reg(action) action :remove do remove_arg = node['kibana']['version'] > 4 ? "bin/kibana-plugin remove #{name}" : "bin/kibana plugin --remove #{name}" - plugin_remove = "#{remove_arg}" + plugin_remove = remove_arg.to_s execute 'plugin-remove' do cwd kibana_home command plugin_remove diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index c7907f0..33994ae 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # matcher for install_ark def install_ark(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:ark, :install, resource_name) diff --git a/test/integration/kibana3_apache/serverspec/default_spec.rb b/test/integration/kibana3_apache/serverspec/default_spec.rb index db8e2cb..d313e61 100644 --- a/test/integration/kibana3_apache/serverspec/default_spec.rb +++ b/test/integration/kibana3_apache/serverspec/default_spec.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'spec_helper' describe 'kibana' do diff --git a/test/integration/kibana3_apache/serverspec/spec_helper.rb b/test/integration/kibana3_apache/serverspec/spec_helper.rb index be8d94d..9998d11 100644 --- a/test/integration/kibana3_apache/serverspec/spec_helper.rb +++ b/test/integration/kibana3_apache/serverspec/spec_helper.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'serverspec' # Required by serverspec diff --git a/test/integration/kibana3_nginx/serverspec/default_spec.rb b/test/integration/kibana3_nginx/serverspec/default_spec.rb index bac028a..1d3f94a 100644 --- a/test/integration/kibana3_nginx/serverspec/default_spec.rb +++ b/test/integration/kibana3_nginx/serverspec/default_spec.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'spec_helper' describe 'kibana' do diff --git a/test/integration/kibana3_nginx/serverspec/spec_helper.rb b/test/integration/kibana3_nginx/serverspec/spec_helper.rb index be8d94d..9998d11 100644 --- a/test/integration/kibana3_nginx/serverspec/spec_helper.rb +++ b/test/integration/kibana3_nginx/serverspec/spec_helper.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'serverspec' # Required by serverspec diff --git a/test/integration/kibana3_source/serverspec/default_spec.rb b/test/integration/kibana3_source/serverspec/default_spec.rb index 7846844..8c634ce 100644 --- a/test/integration/kibana3_source/serverspec/default_spec.rb +++ b/test/integration/kibana3_source/serverspec/default_spec.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'spec_helper' describe 'kibana' do diff --git a/test/integration/kibana3_source/serverspec/spec_helper.rb b/test/integration/kibana3_source/serverspec/spec_helper.rb index be8d94d..9998d11 100644 --- a/test/integration/kibana3_source/serverspec/spec_helper.rb +++ b/test/integration/kibana3_source/serverspec/spec_helper.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'serverspec' # Required by serverspec diff --git a/test/integration/kibana4_apache/serverspec/default_spec.rb b/test/integration/kibana4_apache/serverspec/default_spec.rb index 51e84f8..7e04daf 100644 --- a/test/integration/kibana4_apache/serverspec/default_spec.rb +++ b/test/integration/kibana4_apache/serverspec/default_spec.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'spec_helper' describe 'kibana' do diff --git a/test/integration/kibana4_apache/serverspec/spec_helper.rb b/test/integration/kibana4_apache/serverspec/spec_helper.rb index be8d94d..9998d11 100644 --- a/test/integration/kibana4_apache/serverspec/spec_helper.rb +++ b/test/integration/kibana4_apache/serverspec/spec_helper.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'serverspec' # Required by serverspec diff --git a/test/integration/kibana4_nginx/serverspec/default_spec.rb b/test/integration/kibana4_nginx/serverspec/default_spec.rb index 21964d2..16936fe 100644 --- a/test/integration/kibana4_nginx/serverspec/default_spec.rb +++ b/test/integration/kibana4_nginx/serverspec/default_spec.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'spec_helper' describe 'kibana' do diff --git a/test/integration/kibana4_nginx/serverspec/spec_helper.rb b/test/integration/kibana4_nginx/serverspec/spec_helper.rb index be8d94d..9998d11 100644 --- a/test/integration/kibana4_nginx/serverspec/spec_helper.rb +++ b/test/integration/kibana4_nginx/serverspec/spec_helper.rb @@ -1,5 +1,5 @@ -# Encoding: utf-8 # frozen_string_literal: true + require 'serverspec' # Required by serverspec diff --git a/test/unit/spec/_service_spec.rb b/test/unit/spec/_service_spec.rb index 70ad269..b8efff3 100644 --- a/test/unit/spec/_service_spec.rb +++ b/test/unit/spec/_service_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'chefspec' require_relative 'spec_helper' diff --git a/test/unit/spec/apache_spec.rb b/test/unit/spec/apache_spec.rb index 60ded7b..abf9516 100644 --- a/test/unit/spec/apache_spec.rb +++ b/test/unit/spec/apache_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'chefspec' require_relative 'spec_helper' diff --git a/test/unit/spec/default_spec.rb b/test/unit/spec/default_spec.rb index c37acca..6b6622d 100644 --- a/test/unit/spec/default_spec.rb +++ b/test/unit/spec/default_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'chefspec' require_relative 'spec_helper' diff --git a/test/unit/spec/kibana3_spec.rb b/test/unit/spec/kibana3_spec.rb index d3b5b66..150d36c 100644 --- a/test/unit/spec/kibana3_spec.rb +++ b/test/unit/spec/kibana3_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'chefspec' require_relative 'spec_helper' diff --git a/test/unit/spec/kibana4_spec.rb b/test/unit/spec/kibana4_spec.rb index 518e56e..7c7a661 100644 --- a/test/unit/spec/kibana4_spec.rb +++ b/test/unit/spec/kibana4_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'chefspec' require_relative 'spec_helper' diff --git a/test/unit/spec/nginx_spec.rb b/test/unit/spec/nginx_spec.rb index 1f08c04..14d8ec3 100644 --- a/test/unit/spec/nginx_spec.rb +++ b/test/unit/spec/nginx_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'chefspec' require_relative 'spec_helper' diff --git a/test/unit/spec/spec_helper.rb b/test/unit/spec/spec_helper.rb index add724f..85faf51 100644 --- a/test/unit/spec/spec_helper.rb +++ b/test/unit/spec/spec_helper.rb @@ -1,5 +1,5 @@ -# encoding: UTF-8 # frozen_string_literal: true + # -*- mode: ruby -*- # vi: set ft=ruby : From 05d12e802a59bd5b2ab2f8b4775359f2ea66d075 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 20:52:09 -0700 Subject: [PATCH 08/22] FC028: Use platform? and platform_family? not node.platform? and node.platform_family? --- recipes/kibana4.rb | 2 +- recipes/kibana5.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/kibana4.rb b/recipes/kibana4.rb index 705b7f2..7406067 100644 --- a/recipes/kibana4.rb +++ b/recipes/kibana4.rb @@ -14,7 +14,7 @@ config_path = 'current/config/kibana.yml' elsif node['kibana']['install_method'] == 'package' node.default['kibana']['service']['bin_path'] = 'bin' - if node.platform_family? 'debian' + if platform_family? 'debian' apt_repository 'kibana' do uri node['kibana']['repository_url'] distribution '' diff --git a/recipes/kibana5.rb b/recipes/kibana5.rb index 4232e16..8e30dfb 100644 --- a/recipes/kibana5.rb +++ b/recipes/kibana5.rb @@ -14,7 +14,7 @@ config_path = 'current/config/kibana.yml' elsif node['kibana']['install_method'] == 'package' node.default['kibana']['service']['bin_path'] = 'bin' - if node.platform_family? 'debian' + if platform_family? 'debian' apt_repository 'kibana' do uri node['kibana']['repository_url'] distribution '' From 56e564fc7b83879946cee0425f12c94e8b917b3e Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 20:56:38 -0700 Subject: [PATCH 09/22] FC108: Resource should not define a property named 'name' --- resources/plugin.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/plugin.rb b/resources/plugin.rb index 29538d2..8312c9d 100644 --- a/resources/plugin.rb +++ b/resources/plugin.rb @@ -2,7 +2,6 @@ resource_name :kibana_plugin -property :name, String, name_property: true property :url, String property :kibana_home, String, default: ::File.join(node['kibana']['base_dir'], 'current') property :plugins_registry, String, default: ::File.join(node['kibana']['base_dir'], 'installedPugins.json') From 56914a6c21fdba94ffae0e60e90d327c68e3ca6c Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 21:42:26 -0700 Subject: [PATCH 10/22] set version 4 correctly --- test/unit/spec/kibana4_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/spec/kibana4_spec.rb b/test/unit/spec/kibana4_spec.rb index 7c7a661..e0ef08d 100644 --- a/test/unit/spec/kibana4_spec.rb +++ b/test/unit/spec/kibana4_spec.rb @@ -8,6 +8,7 @@ let(:chef_run) do ChefSpec::SoloRunner.new(UBUNTU_OPTS) do |node| + node.normal['kibana']['version'] = 4 node.default['kibana']['install_method'] = 'release' end.converge(described_recipe, 'kibana::_service') end From 63d20c0f6c76ea125eca7a35fba764634d131ca1 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 21:43:07 -0700 Subject: [PATCH 11/22] update fauxhai platform versions to fix warning --- test/unit/spec/spec_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/spec/spec_helper.rb b/test/unit/spec/spec_helper.rb index 85faf51..4379f96 100644 --- a/test/unit/spec/spec_helper.rb +++ b/test/unit/spec/spec_helper.rb @@ -21,11 +21,11 @@ }.freeze ::CENTOS_OPTS = { platform: 'centos', - version: '6.0' + version: '6.9' }.freeze ::CENTOS7_OPTS = { platform: 'centos', - version: '7.0' + version: '7.4.1708' }.freeze def stub_resources; end From 944ae133b4ff437f491e166dc959c35a2f8970c6 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 21:43:25 -0700 Subject: [PATCH 12/22] dummy test please ignore --- test/unit/spec/apache_spec.rb | 4 ++++ test/unit/spec/nginx_spec.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/unit/spec/apache_spec.rb b/test/unit/spec/apache_spec.rb index abf9516..7e41d63 100644 --- a/test/unit/spec/apache_spec.rb +++ b/test/unit/spec/apache_spec.rb @@ -10,4 +10,8 @@ # TODO: creates a template /etc/apache2/htpasswd # TODO: creates a template /etc/apache2/sites-available/kibana.conf + + it 'converges successfully' do + expect { :chef_run }.to_not raise_error + end end diff --git a/test/unit/spec/nginx_spec.rb b/test/unit/spec/nginx_spec.rb index 14d8ec3..79b9194 100644 --- a/test/unit/spec/nginx_spec.rb +++ b/test/unit/spec/nginx_spec.rb @@ -7,4 +7,8 @@ before { stub_resources } let(:chef_run) { ChefSpec::SoloRunner.new(UBUNTU_OPTS).converge(described_recipe) } + + it 'converges successfully' do + expect { :chef_run }.to_not raise_error + end end From 51154c02e53ba0621131a4d70634bda1d2ae7aab Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 21:44:21 -0700 Subject: [PATCH 13/22] fix init service file for centos --- test/unit/spec/_service_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/spec/_service_spec.rb b/test/unit/spec/_service_spec.rb index b8efff3..ea68470 100644 --- a/test/unit/spec/_service_spec.rb +++ b/test/unit/spec/_service_spec.rb @@ -39,10 +39,10 @@ describe 'kibana::_service' do before { stub_resources } let(:chef_run) { ChefSpec::SoloRunner.new(CENTOS_OPTS).converge(described_recipe) } - let(:template) { chef_run.template('/etc/init.d/kibana') } + let(:template) { chef_run.template('/usr/lib/systemd/system/kibana.service') } - it 'creates an init.d template at /etc/init.d/kibana' do - expect(chef_run).to create_template('/etc/init.d/kibana') + it 'creates an init.d template at /usr/lib/systemd/system/kibana.service' do + expect(chef_run).to create_template('/usr/lib/systemd/system/kibana.service') end it 'enables a kibana service' do expect(chef_run).to enable_service('kibana') From 8cabbacccb03ee8b389c861797eaa516ee0cbdd8 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 22:03:53 -0700 Subject: [PATCH 14/22] correct description to reflect reality --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f4bb2f..f6b3aac 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req * `node['kibana']['base_dir']` - The base directory of kibana. Defaults to `/opt/kibana`. * `node['kibana']['user']` - The user under which Kibana is installed. Defaults to `kibana`. * `node['kibana']['group']` - The group under which Kibana is installed. Defaults to `kibana`. -* `node['kibana']['install_method']` - Install method. Can be source or release. Defaults to `release`. +* `node['kibana']['install_method']` - Install method. Can be `package` or `release`. Defaults to `release`. * `node['kibana']['url']` - Url of tarball. Defaults to `https://download.elasticsearch.org/kibana/kibana/kibana-#{node['kibana']['kibana3_version']}.tar.gz`. * `node['kibana']['kibana3_checksum']` - Checksum of the tarball. * `node['kibana']['kibana4_checksum']` - Checksum of the tarball. From 1d7a9efc2f1f2f024cb67b2cd408e703b0c827bb Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 22:04:12 -0700 Subject: [PATCH 15/22] update platforms to reflect reality --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6b3aac..920907f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req ## Platform: -* Ubuntu 12.04, 14.04. +* Ubuntu 14.04, 16.04 * CentOS 6, 7 ## Cookbooks: From f7d4ad855e3fa30128c0e2ea41a96dc497b863ee Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 22:05:12 -0700 Subject: [PATCH 16/22] add mention of recipe --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 920907f..4abcba7 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req * [kibana::default](#kibanadefault) - Install Kibana. * kibana::kibana3 * kibana::kibana4 +* kibana::kibana5 * kibana::nginx ## kibana::apache From 8cc450bf7b6cb4e6d39cc6e26b18d21566b25299 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 22:06:04 -0700 Subject: [PATCH 17/22] make derived url follow the same pattern as v4 and v5 --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 61a45ec..1aa54e6 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -6,7 +6,7 @@ #<> Kibana3 exact version default['kibana']['kibana3_version'] = '3.1.2' default['kibana']['kibana3_checksum'] = '480562733c2c941525bfa26326b6fae5faf83109b452a6c4e283a5c37e3086ee' -default['kibana']['kibana3_url'] = 'https://download.elastic.co/kibana/kibana/kibana-3.1.2.tar.gz' +default['kibana']['kibana3_url'] = "https://download.elastic.co/kibana/kibana/kibana-#{node['kibana']['kibana3_version']}.tar.gz" #<> Kibana4 exact version default['kibana']['kibana4_version'] = '4.6.6' From b3c45d2f825cc0d6d6f5ecc5829f5588b22c1f63 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 22:29:55 -0700 Subject: [PATCH 18/22] add @mburns as contributor --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4abcba7..a0f4e88 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,6 @@ end # License and Maintainers -Maintainers:: Peter Donald (), Dimitry Ryobryshkin (@cyberflow), Scott Nelson Windels () +Maintainers:: Peter Donald (), Dimitry Ryobryshkin (@cyberflow), Scott Nelson Windels (), Michael Burns (@mburns) License:: Apache 2.0 From 4c646719d7592d41b0d72f39992e5d1f9c910863 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 23:09:44 -0700 Subject: [PATCH 19/22] kibana4 test --- test/unit/spec/kibana4_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/spec/kibana4_spec.rb b/test/unit/spec/kibana4_spec.rb index e0ef08d..48cfb14 100644 --- a/test/unit/spec/kibana4_spec.rb +++ b/test/unit/spec/kibana4_spec.rb @@ -8,8 +8,8 @@ let(:chef_run) do ChefSpec::SoloRunner.new(UBUNTU_OPTS) do |node| - node.normal['kibana']['version'] = 4 - node.default['kibana']['install_method'] = 'release' + node.override['kibana']['version'] = 4 + node.override['kibana']['install_method'] = 'release' end.converge(described_recipe, 'kibana::_service') end let(:template) { chef_run.template('/opt/kibana/current/config/kibana.yml') } From db91f26c9ad7d6046d831deb2e9dba53291a445b Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 23:13:46 -0700 Subject: [PATCH 20/22] add build-essential requirement --- Berksfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Berksfile b/Berksfile index adbadf4..829f25d 100644 --- a/Berksfile +++ b/Berksfile @@ -8,9 +8,10 @@ group :vagrant do cookbook 'ark', '>= 2.2.1' cookbook 'apt' cookbook 'apache2' + cookbook 'build-essential' cookbook 'elasticsearch', '~ 2.4.0' cookbook 'java' - cookbook 'ohai' cookbook 'netstat' + cookbook 'ohai' cookbook 'chef_nginx', '~ 2.9.0' end From 9e17a2a324b1db1cb77d2ab7a66a24814d24f08b Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 23:24:37 -0700 Subject: [PATCH 21/22] use foodcritic gem directly --- Rakefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index ccf6ee9..8348bb9 100644 --- a/Rakefile +++ b/Rakefile @@ -5,6 +5,7 @@ require 'rake/testtask' require 'rspec/core/rake_task' require 'rubocop/rake_task' require 'bundler/setup' +require 'foodcritic' require 'stove/rake_task' Stove::RakeTask.new @@ -14,9 +15,14 @@ RuboCop::RakeTask.new(:rubocop) do |task| task.fail_on_error = true end -desc 'Foodcritic linter' -task :foodcritic do - sh 'foodcritic -f any -t ~FC007 .' +FoodCritic::Rake::LintTask.new do |t| + t.options = { + fail_tags: ['any'], + tags: [ + '~FC007', # Don't reflect recipe dependencies + '~FC071' # Don't require LICENSE file + ] + } end desc 'Run Test Kitchen integration tests' From 31331f9fa3d9de1c0bcc6915811d888a6a65f0b7 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 15 Mar 2018 23:35:50 -0700 Subject: [PATCH 22/22] bump version --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c0837e3..2a123ac 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ license 'Apache-2.0' description 'Installs/Configures kibana, the logstash UI' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.2.1' +version '0.2.2' source_url 'https://github.com/realityforge/chef-kibana' issues_url 'https://github.com/realityforge/chef-kibana/issues'