Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Replace node.set to node.default. #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Provider::KibanaInstall < Chef::Provider::LWRPBase # ~FC057, ~FC058
link "#{kb_args[:install_dir]}/current" do
to "#{kb_args[:install_dir]}/#{kb_args[:git_branch]}/src"
end
node.set['kibana'][kb_args[:name]]['web_dir'] = "#{kb_args[:install_dir]}/current/src"
node.default['kibana'][kb_args[:name]]['web_dir'] = "#{kb_args[:install_dir]}/current/src"

when 'file'
@run_context.include_recipe 'libarchive::default'
Expand All @@ -96,7 +96,7 @@ class Provider::KibanaInstall < Chef::Provider::LWRPBase # ~FC057, ~FC058
to "#{kb_args[:install_dir]}/kibana-#{kb_args[:version]}"
end

node.set['kibana'][kb_args[:name]]['web_dir'] = "#{kb_args[:install_dir]}/current"
node.default['kibana'][kb_args[:name]]['web_dir'] = "#{kb_args[:install_dir]}/current"
node.save unless Chef::Config[:solo]
end
end # end case
Expand Down
10 changes: 5 additions & 5 deletions libraries/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class Provider::KibanaWeb < Chef::Provider::LWRPBase # ~FC057, ~FC058

case resources[:type]
when 'apache'
node.set['apache']['default_site_enabled'] = resources[:default_site_enabled]
node.default['apache']['default_site_enabled'] = resources[:default_site_enabled]

node.set['apache']['listen_ports'] = [] unless resources[:default_site_enabled]
node.set['apache']['listen_ports'] << resources[:listen_port]
node.default['apache']['listen_ports'] = [] unless resources[:default_site_enabled]
node.default['apache']['listen_ports'] << resources[:listen_port]

%w(apache2 apache2::mod_dir apache2::mod_proxy apache2::mod_proxy_http).each do |recipe|
@run_context.include_recipe recipe
Expand All @@ -64,8 +64,8 @@ class Provider::KibanaWeb < Chef::Provider::LWRPBase # ~FC057, ~FC058
end

when 'nginx'
node.set['nginx']['default_site_enabled'] = resources[:default_site_enabled]
node.set['nginx']['install_method'] = node['kibana']['nginx']['install_method']
node.default['nginx']['default_site_enabled'] = resources[:default_site_enabled]
node.default['nginx']['install_method'] = node['kibana']['nginx']['install_method']
@run_context.include_recipe 'chef_nginx'

template "#{node['nginx']['dir']}/sites-available/#{resources[:name]}" do
Expand Down
2 changes: 1 addition & 1 deletion recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
unless Chef::Config[:solo]
es_server_results = search(:node, "roles:#{node['kibana']['es_role']} AND chef_environment:#{node.chef_environment}")
unless es_server_results.empty?
node.set['kibana']['es_server'] = es_server_results[0]['ipaddress']
node.default['kibana']['es_server'] = es_server_results[0]['ipaddress']
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/unit/spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let(:node) { runner.node }
let(:chef_run) do
# runner.node.set['logstash'] ...
runner.node.set['kibana']['legacy_mode'] = 'false'
runner.node.default['kibana']['legacy_mode'] = 'false'
runner.node.automatic['memory']['total'] = '1024kB'
runner.converge(described_recipe)
end
Expand Down
26 changes: 13 additions & 13 deletions test/unit/spec/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
let(:runner) { ChefSpec::ServerRunner.new(::UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
# runner.node.set['logstash'] ...
runner.node.set['kibana']['user'] = 'kibanana'
runner.node.set['kibana']['install_dir'] = '/opt/kibanana'
runner.node.set['kibana']['install_type'] = 'file'
runner.node.set['kibana']['config_template'] = 'config.js.erb'
runner.node.set['kibana']['config_cookbook'] = 'kibana'
runner.node.set['kibana']['webserver'] = 'nginx'
runner.node.set['kibana']['es_server'] = '127.0.0.1'
runner.node.set['kibana']['nginx']['template'] = 'kibana-nginx.conf.erb'
runner.node.set['kibana']['nginx']['template_cookbook'] = 'kibana'
runner.node.set['kibana']['nginx']['enable_default_site'] = false
runner.node.set['kibana']['nginx']['install_method'] = 'package'
runner.node.set['kibana']['service']['options']['sv_timeout'] = 42
# runner.node.default['logstash'] ...
runner.node.default['kibana']['user'] = 'kibanana'
runner.node.default['kibana']['install_dir'] = '/opt/kibanana'
runner.node.default['kibana']['install_type'] = 'file'
runner.node.default['kibana']['config_template'] = 'config.js.erb'
runner.node.default['kibana']['config_cookbook'] = 'kibana'
runner.node.default['kibana']['webserver'] = 'nginx'
runner.node.default['kibana']['es_server'] = '127.0.0.1'
runner.node.default['kibana']['nginx']['template'] = 'kibana-nginx.conf.erb'
runner.node.default['kibana']['nginx']['template_cookbook'] = 'kibana'
runner.node.default['kibana']['nginx']['enable_default_site'] = false
runner.node.default['kibana']['nginx']['install_method'] = 'package'
runner.node.default['kibana']['service']['options']['sv_timeout'] = 42
runner.node.automatic['memory']['total'] = '1024kB'
runner.converge(described_recipe)
end
Expand Down