Skip to content

Commit

Permalink
fix provides and $NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesonjlee committed Nov 17, 2013
1 parent 16b4846 commit dd2b003
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions definitions/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
end

if type != "mongos"
daemon = "/usr/bin/mongod"
provider = "mongod"
configserver = nil
else
daemon = "/usr/bin/mongos"
provider = "mongos"
dbpath = nil
configserver = configserver_nodes.collect{|n| "#{(n['mongodb']['configserver_url'] || n['fqdn'])}:#{n['mongodb']['port']}" }.sort.join(",")
end
Expand Down Expand Up @@ -130,14 +130,15 @@
init_file = File.join(node['mongodb']['init_dir'], "#{name}")
end
template init_file do
action :create
cookbook node['mongodb']['template_cookbook']
source node[:mongodb][:init_script_template]
group node['mongodb']['root_group']
owner "root"
mode "0755"
variables :provides => name, :emits_pid => type != "mongos"
notifies :restart, "service[#{name}]"
variables({
:provides => provider
})
action :create
end

# service
Expand Down
2 changes: 1 addition & 1 deletion recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
owner "root"
mode "0755"
variables({
:provides => 'mongod'
:provides => "mongod"
})
action :create_if_missing
end
Expand Down
4 changes: 2 additions & 2 deletions templates/default/debian-mongodb.init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
# functionality are the goals for the project.
### END INIT INFO
#
NAME=<%= @provides %>

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC=database
PIDFILE=/var/run/$NAME.pid
ENABLE_MONGODB=yes
SYSCONFIG=<%= node['mongodb']['sysconfig_file'] %>

NAME=<%= @provides %>

# this should get removed at some point for more shell agnostic init script
ulimit -f <%= node.mongodb.ulimit.fsize %>
ulimit -t <%= node.mongodb.ulimit.cpu %>
Expand Down
1 change: 1 addition & 0 deletions templates/default/debian-mongodb.upstart.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ start on runlevel [2345]
stop on runlevel [06]

script
NAME=<%= @provides %>
ENABLE_MONGODB="yes"
if [ -f <%= node['mongodb']['sysconfig_file'] %> ]; then
. <%= node['mongodb']['sysconfig_file'] %>;
Expand Down

0 comments on commit dd2b003

Please sign in to comment.