Skip to content

Commit

Permalink
Added an option to enable/disable the ReST interface of the mongodb w…
Browse files Browse the repository at this point in the history
…ebinterface, per default it is turned off.
  • Loading branch information
Markus Korn committed Oct 25, 2011
1 parent 4eaed04 commit 09777a1
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mongodb/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@
default[:mongodb][:cluster_name] = nil
default[:mongodb][:replicaset_name] = nil
default[:mongodb][:shard_name] = "default"

default[:mongodb][:enable_rest] = false
6 changes: 4 additions & 2 deletions mongodb/definitions/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

define :mongodb_instance, :mongodb_type => "mongod" , :action => [:enable, :start], :port => 27017 , \
:logpath => "/var/log/mongodb", :dbpath => "/data", :configfile => "/etc/mongodb.conf", \
:configserver => [], :replicaset => nil, :notifies => [] do
:configserver => [], :replicaset => nil, :enable_rest => false, \
:notifies => [] do

include_recipe "mongodb::default"

Expand Down Expand Up @@ -94,7 +95,8 @@
"dbpath" => dbpath,
"replicaset_name" => replicaset_name,
"configsrv" => false, #type == "configserver", this might change the port
"shardsrv" => false #type == "shard", dito.
"shardsrv" => false, #type == "shard", dito.
"enable_rest" => params[:enable_rest]
)
notifies :restart, "service[#{name}]"
end
Expand Down
13 changes: 13 additions & 0 deletions mongodb/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@
"description": "Name of a mongodb replicaset",
"display_name": "Replicaset_name"
},
"mongodb/enable_rest": {
"required": "optional",
"calculated": false,
"choice": [

],
"type": "string",
"recipes": [

],
"description": "Enable the ReST interface of the webserver",
"display_name": "Enable Rest"
},
"mongodb/cluster_name": {
"required": "optional",
"calculated": false,
Expand Down
3 changes: 3 additions & 0 deletions mongodb/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@
:description => "Name of a mongodb replicaset",
:default => nil

attribute "mongodb/enable_rest",
:display_name => "Enable Rest",
:description => "Enable the ReST interface of the webserver"
1 change: 1 addition & 0 deletions mongodb/recipes/configserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
port node['mongodb']['port']
logpath node['mongodb']['logpath']
dbpath node['mongodb']['dbpath']
enable_rest node['mongodb']['enable_rest']
end
1 change: 1 addition & 0 deletions mongodb/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@
port node['mongodb']['port']
logpath node['mongodb']['logpath']
dbpath node['mongodb']['dbpath']
enable_rest node['mongodb']['enable_rest']
end
end
1 change: 1 addition & 0 deletions mongodb/recipes/mongos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@
logpath node['mongodb']['logpath']
dbpath node['mongodb']['dbpath']
configserver configsrv
enable_rest node['mongodb']['enable_rest']
end
1 change: 1 addition & 0 deletions mongodb/recipes/replicaset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
logpath node['mongodb']['logpath']
dbpath node['mongodb']['dbpath']
replicaset node
enable_rest node['mongodb']['enable_rest']
end
end
1 change: 1 addition & 0 deletions mongodb/recipes/shard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@
if is_replicated
replicaset node
end
enable_rest node['mongodb']['enable_rest']
end
4 changes: 4 additions & 0 deletions mongodb/templates/default/mongodb.default.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ DAEMON_OPTS=""
<% if @replicaset_name %>
DAEMON_OPTS="$DAEMON_OPTS --replSet <%= @replicaset_name %>"
<% end %>
<% if @enable_rest %>
DAEMON_OPTS="$DAEMON_OPTS --rest"
<% end %>

0 comments on commit 09777a1

Please sign in to comment.