anuriq / chef-kibana5

Chef cookbook for installing Kibana 5.x.x
https://supermarket.chef.io/cookbooks/kibana5
Apache License 2.0
5 stars 15 forks source link

Cookbook installs kibana version 5.4.1 even though node['kibana5']['version'] is set to something else #13

Closed iancward closed 7 years ago

iancward commented 7 years ago

I saw that the latest version of this cookbook sets the default version to a node attribute, which would seem to allow a user to change the version to be installed by changing that attribute; however, it looks like it doesn't actually have any effect.

In a wrapper cookbook, I set the node['kibana5']['version'] attribute to 5.3.0 but when chef converges the node, kibana version 5.4.1 is installed. It might be necessary to set the version property of the kibana_install resource in the default recipe here.

anuriq commented 7 years ago

Hi @iancward Could you share a piece of code, where you set the attribute, please?

iancward commented 7 years ago

this is what I have in my wrapper recipe:

node.default['kibana5']['distribution']['5.3.0']['release']['x64']['url'] = '<internal repo here>'
node.default['kibana5']['version'] = '5.3.0'

include_recipe "#{cookbook_name}::elasticsearch"
include_recipe 'kibana5'

The host I'm working on is behind a firewall, so it can't access the internet directly, and I'm getting a chef run failure because it can't install kibana 5.4.1 from the "normal" location (https://artifacts.elastic.co/downloads/kibana).

I switched over to a host with internet access, and it successfully installed Kibana 5.4.1, even though the version attribute was set to 5.3.0.

Here's some code that I was able to fetch from chef-shell:

chef (12.14.89)> recipe_mode
chef:recipe (12.14.89)> node.debug_value('kibana5', 'version')
 => [["default", "5.3.0"], ["env_default", :not_present], ["role_default", :not_present], ["force_default", :not_present], ["normal", :not_present], ["override", :not_present], ["role_override", :not_present], ["env_override", :not_present], ["force_override", :not_present], ["automatic", :not_present]] 
chef:recipe (12.14.89)> r = resources('kibana5_install[kibana]')
<kibana5_install[kibana] @name: "kibana" @noop: nil @before: nil @params: {} @provider: nil @allowed_actions: [:nothing, :install] @action: [:install] @updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @source_line: "/var/chef/cache/cookbooks/kibana5/recipes/default.rb:19:in `from_file'" @guard_interpreter: nil @default_guard_interpreter: :default @elapsed_time: 0 @sensitive: false @declared_type: :kibana5_install @cookbook_name: "kibana5" @recipe_name: "default">
 => <kibana5_install[kibana] @name: "kibana" @noop: nil @before: nil @params: {} @provider: nil @allowed_actions: [:nothing, :install] @action: [:install] @updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @source_line: "/var/chef/cache/cookbooks/kibana5/recipes/default.rb:19:in `from_file'" @guard_interpreter: nil @default_guard_interpreter: :default @elapsed_time: 0 @sensitive: false @declared_type: :kibana5_install @cookbook_name: "kibana5" @recipe_name: "default"> 
chef:recipe (12.14.89)> r.version
 => "5.4.1"
anuriq commented 7 years ago

sorry, closed by mistake. this should be fixed in 1.1.1. Could you take a look?

iancward commented 7 years ago

Hi @anuriq: Sorry for the delay on my response, but I just spun up a test kitchen instance with version 1.1.1 of this cookbook and it installed the right version. Thanks for the help!

anuriq commented 7 years ago

Hi @iancward thanks for confirmation. i am closing this ticket.