Skip to content

Commit

Permalink
add mongorestore_path as a configurable option
Browse files Browse the repository at this point in the history
Change-Id: I61c984a5993a390cac91a3ddcc9d03eb205350db
  • Loading branch information
anferneeg committed Jun 13, 2011
1 parent d5a5390 commit 2dc7ab7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions mongodb/bin/mongodb_node
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ options = {
:index => parse_property(config, "index", Integer, :optional => true),
:base_dir => parse_property(config, "base_dir", String),
:mongod_path => parse_property(config, "mongod_path", String),
:mongorestore_path => parse_property(config, "mongorestore_path", String),
:ip_route => parse_property(config, "ip_route", String, :optional => true),
:available_memory => parse_property(config, "available_memory", Integer),
:node_id => parse_property(config, "node_id", String),
Expand Down
1 change: 1 addition & 0 deletions mongodb/config/mongodb_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ available_memory: 4096
max_memory: 128
node_id: mongodb_node_1
mongod_path: mongod
mongorestore_path: mongorestore
port_range:
first: 25001
last: 45000
Expand Down
3 changes: 2 additions & 1 deletion mongodb/lib/mongodb_service/mongodb_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def initialize(options)
@base_dir = options[:base_dir]
FileUtils.mkdir_p(@base_dir)
@mongod_path = options[:mongod_path]
@mongorestore_path = options[:mongorestore_path]

@total_memory = options[:available_memory]
@available_memory = options[:available_memory]
Expand Down Expand Up @@ -279,7 +280,7 @@ def restore(instance_id, backup_file)
end

# Run mongorestore
command = "mongorestore -u #{username} -p#{password} --port #{port} #{backup_file}"
command = "#{@mongorestore_path} -u #{username} -p#{password} --port #{port} #{backup_file}"
output = `#{command}`
res = $?.success?
@logger.debug(output)
Expand Down
1 change: 1 addition & 0 deletions mongodb/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def get_node_config()
options = {
:logger => Logger.new(parse_property(config, "log_file", String, :optional => true) || STDOUT, "daily"),
:mongod_path => parse_property(config, "mongod_path", String),
:mongorestore_path => parse_property(config, "mongorestore_path", String),
:ip_route => parse_property(config, "ip_route", String, :optional => true),
:available_memory => parse_property(config, "available_memory", Integer),
:node_id => parse_property(config, "node_id", String),
Expand Down

0 comments on commit 2dc7ab7

Please sign in to comment.