Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default recipe and modify default template #11

Open
wants to merge 7 commits 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
3 changes: 0 additions & 3 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
end

service 'beanstalkd' do
start_command '/etc/init.d/beanstalkd start'
stop_command '/etc/init.d/beanstalkd stop'
status_command '/etc/init.d/beanstalkd status'
supports [:start, :stop, :status]
# starts the service if it's not running and enables it to start at system boot time
action [:enable, :start]
Expand Down
16 changes: 16 additions & 0 deletions spec/unit/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,20 @@

describe 'beanstalkd::default' do
let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }

it 'should upgrade the beanstalkd' do
expect(chef_run).to upgrade_package('beanstalkd')
end

it 'should deploy the beanstalkd template' do
expect(chef_run).to create_template('/etc/sysconfig/beanstalkd')
end

it 'must enable the beanstalkd service' do
expect(chef_run).to enable_service('beanstalkd')
end

it 'should start the beanstalkd service' do
expect(chef_run).to start_service('beanstalkd')
end
end
14 changes: 7 additions & 7 deletions templates/default/beanstalkd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
# Available options correspond to the options to the
# beanstalkd commandline.

BEANSTALKD_ADDR=<% if @opts['l'].nil? %>0.0.0.0<% else %><%= @opts['l'] %><% end %>
BEANSTALKD_PORT=<% if @opts['p'].nil? %>11300<% else %><%= @opts['p'] %><% end %>
BEANSTALKD_USER=<% if @opts['u'].nil? %>beanstalkd<% else %><%= @opts['u'] %><% end %>
ADDR= -l <% if @opts['l'].nil? %>0.0.0.0<% else %><%= @opts['l'] %><% end %>
PORT= -p <% if @opts['p'].nil? %>11300<% else %><%= @opts['p'] %><% end %>
USER= -u <% if @opts['u'].nil? %>beanstalkd<% else %><%= @opts['u'] %><% end %>

# Job size is left to the default. Uncomment and set it
# to a value to have it take affect.
<% unless @opts['z'] %>#<% end %>BEANSTALKD_MAX_JOB_SIZE=<% if @opts['z'].nil? %>65535<% else %><%= @opts['z'] %><% end %>
<% unless @opts['z'] %>#<% end %>MAX_JOB_SIZE= -z <% if @opts['z'].nil? %>65535<% else %><%= @opts['z'] %><% end %>

# Using the binlog is off by default.
#
# The direcory to house the binlog.
<% unless @opts['b'] %>#<% end %>BEANSTALKD_BINLOG_DIR=<% if @opts['b'].nil? %>/var/lib/beanstalkd/binlog<% else %><%= @opts['b'] %><% end %>
<% unless @opts['b'] %>#<% end %>$BINLOG_DIR= -b <% if @opts['b'].nil? %>/var/lib/beanstalkd/binlog<% else %><%= @opts['b'] %><% end %>

#
# fsync the binlog at most once every N milliseconds.
# setting this to 0 means 'always fsync'. If this is unset,
# and the binlog is used, then no explicit fsync is ever
# performed. That is, the -F option is used.
<% unless @opts['f'] %>#<% end %>BEANSTALKD_BINLOG_FSYNC_PERIOD=<% if @opts['f'].nil? %><% else %><%= @opts['f'] %><% end %>
<% unless @opts['f'] %>#<% end %>BINLOG_FSYNC_PERIOD= -f <% if @opts['f'].nil? %><% else %><%= @opts['f'] %><% end %>

#
# The size of each binlog file. This is rounded
# up to the nearest 512 byte boundary.
<% unless @opts['s'] %>#<% end %>BEANSTALKD_BINLOG_SIZE=<% if @opts['s'].nil? %>10485760<% else %><%= @opts['s'] %><% end %>
<% unless @opts['s'] %>#<% end %>BINLOG_SIZE= -s <% if @opts['s'].nil? %>10485760<% else %><%= @opts['s'] %><% end %>

<% unless @start_during_boot %>#<% end %>START=yes