Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[services-ng] dump file directly into snapshot folder

Change-Id: I0a80df0c80f8d09ce8ca2e9d8458dfa9f78b6cc5
  • Loading branch information...
commit 583f75ce87512a8987df7636370b9988e24ae0e3 1 parent d7a897b
@Seanzhao Seanzhao authored
Showing with 2 additions and 7 deletions.
  1. +2 −7 ng/mongodb/lib/mongodb_service/job/util.rb
View
9 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)
Please sign in to comment.
Something went wrong with that request. Please try again.