Skip to content

Commit

Permalink
kitchen refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
laradji committed Nov 12, 2012
1 parent eef4497 commit d3b1b78
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require File.expand_path('../support/helpers.rb', __FILE__)

describe 'zabbix::server' do
describe 'zabbix::server_source' do
include Helpers::Zabbix

it "creates a user for the daemon to run as" do
Expand All @@ -10,4 +10,5 @@
it 'runs as a daemon' do
service("zabbix_server").must_be_running
end

end
2 changes: 1 addition & 1 deletion recipes/agent_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
end

# Download zabbix source code
remote_file "#{node.zabbix.src_dir}/zabbix-#{node['zabbix']['agent']['version']}-agent.tar.gz" do
remote_file "#{node['zabbix']['src_dir']}/zabbix-#{node['zabbix']['agent']['version']}-agent.tar.gz" do
source "http://downloads.sourceforge.net/project/zabbix/#{node['zabbix']['agent']['branch']}/#{node['zabbix']['agent']['version']}/zabbix-#{node['zabbix']['agent']['version']}.tar.gz"
mode "0644"
action :create_if_missing
Expand Down
2 changes: 1 addition & 1 deletion recipes/firewall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
action :enable
end

if node.zabbix.server.install == true
if node['zabbix']['server']['install'] == true
# Search for some client
if Chef::Config[:solo]
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
Expand Down
1 change: 1 addition & 0 deletions recipes/mysql_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

include_recipe "database"


# generate the password
node.set_unless['zabbix']['server']['dbpassword'] = secure_password

Expand Down
4 changes: 3 additions & 1 deletion recipes/server_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
# Apache 2.0
#

if node['zabbix']['server']['install']
include_recipe "zabbix::default"

if node['zabbix']['server']['install'] && node['zabbix']['server']['db_install_method'] == "mysql"
include_recipe "mysql::client"
end

Expand Down
5 changes: 3 additions & 2 deletions test/kitchen/Kitchenfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
cookbook "zabbix" do
configuration "default"
configuration "server"
configuration "server_source"
exclude :platform => 'centos'
exclude :platform => 'debian'
exclude :platform => 'redhat'

run_list_extras ['mysql::server']

runtimes []

end
5 changes: 5 additions & 0 deletions test/kitchen/cookbooks/zabbix-test/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
maintainer "Efactures"
maintainer_email "nacer.laradji@gmail.com"
license "Apache 2.0"
description "This cookbook is used with test-kitchen to test the parent, zabbix cookbook."
version "1.0.0"
10 changes: 10 additions & 0 deletions test/kitchen/cookbooks/zabbix-test/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Author:: Nacer Laradji (<nacer.laradji@gmail.com>)
# Cookbook Name:: zabbix-test
# Recipe:: default
#
# Copyright 2011, Efactures
#
# Apache 2.0


include_recipe "zabbix::default"
10 changes: 10 additions & 0 deletions test/kitchen/cookbooks/zabbix-test/recipes/server_source.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Author:: Nacer Laradji (<nacer.laradji@gmail.com>)
# Cookbook Name:: zabbix-test
# Recipe:: server_source
#
# Copyright 2011, Efactures
#
# Apache 2.0

node.set['zabbix']['server']['install'] = true
include_recipe "zabbix::server_source"

0 comments on commit d3b1b78

Please sign in to comment.