Permalink
Browse files

Merge "[services-ng] dump file directly into snapshot folder"

  • Loading branch information...
2 parents 95d43eb + 583f75c commit 4c7e0a4d0bd1123a2fa7e661c79406c1632197e3 @Seanzhao Seanzhao committed with Gerrit Code Review Dec 11, 2012
Showing with 2 additions and 7 deletions.
  1. +2 −7 ng/mongodb/lib/mongodb_service/job/util.rb
@@ -28,12 +28,10 @@ def dump_database(service_id, file, opts={})
tar_path = @config['tar_path'] ? @config['tar_path'] : 'tar'
cmd_timeout = @config['timeout'].to_f
-
- tmp_dir = Dir.mktmpdir
+ tmp_dir = Dir.mktmpdir(nil, @config['tmp_dir'])
service = Node::ProvisionedService.get(service_id)
version = service.version || @config["default_version"]
mongodump_path = @config['mongodump_path'] ? @config['mongodump_path'][version.to_s] : 'mongodump'
-
commands = [ "#{mongodump_path} -h #{service.ip}:27017 -u #{service.admin} -p #{service.adminpass} -o #{tmp_dir} ", \
"#{tar_path} czf #{file} -C #{tmp_dir} ." ]
@@ -78,10 +76,7 @@ def restore_database(service_id, file)
mongorestore_path = @config['mongorestore_path'] ? @config['mongorestore_path'][version.to_s] : 'mongorestore'
tar_path = @config['tar_path'] ? @config['tar_path'] : 'tar'
cmd_timeout = @config['timeout'].to_f
-
-
- tmp_dir = Dir.mktmpdir
-
+ tmp_dir = Dir.mktmpdir(nil, @config['tmp_dir'])
service = Node::ProvisionedService.get(service_id)
db = Mongo::Connection.new(service.ip, 27017).db(service.db)
db.authenticate(service.admin, service.adminpass)

0 comments on commit 4c7e0a4

Please sign in to comment.