mondupe 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mondupe.rb +8 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7d703857e8d7c12215b8cbb9bb707777fc7c6d7
4
- data.tar.gz: f1c44d57c2d7d8acc440cd67d2da43efd6214b73
3
+ metadata.gz: 37a24f55245052e8247a19ac6136ae03ba45a639
4
+ data.tar.gz: cc08d1377481e511feaa1978361e4bf86b931035
5
5
  SHA512:
6
- metadata.gz: 3a1bd390cece32936cc9dc0f8f5f7305b3933f143ab92184b99928c428d8634910260633155a82fb4fe869d618721402d9322507a0c4a4d5c1865e88a6f59d20
7
- data.tar.gz: 9008e32d33169ac451c15d97b0b976dc6df9cf015cfa6f138b7b9c0d8262e59f47546a155bf8a77809f58e1d491407af8ba944768452c2ffb6316c50e89d9bd0
6
+ metadata.gz: 1eb9ab405138d2bfe5493f4eef966685a3fdb42f4e09e5a56f3e1a9044bda1a43bc51c346745ae8207bb920c7d97ecf427595856851c273b7d65f88ee225ae62
7
+ data.tar.gz: a6d365ef47e7a9be6de5d8b33d66097d60eae1d0b1625a22d0dc8f5864b35056c5ce0ceba3525beb8f8b9f9fdbc922b02e91f591b2d43987e318644a2069d8b0
data/lib/mondupe.rb CHANGED
@@ -115,14 +115,21 @@ class Mondupe
115
115
  puts "#{Time.now.to_s} - Dropping existing database"
116
116
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "echo 'db.dropDatabase()' | mongo cde_production"`
117
117
  if $?.success? then puts "#{Time.now.to_s} - Database drop complete" else die("Error dropping database") end
118
+ puts "Extracting database dump archive file..."
119
+ `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "cd #{dump_tmp_path}; tar xf #{dump_file_name}"`
120
+ if $?.success? then puts "#{Time.now.to_s} - Extraction complete!" else die("Error extracting archive") end
118
121
  puts "Restoring Mongo Database from extracted dump: #{File.join(dump_tmp_path, "cde_production")}"
119
- `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "cd #{dump_tmp_path}; tar xf #{dump_file_name}; time mongorestore /tmp/cde_production"`
122
+ `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "time mongorestore #{File.join(dump_tmp_path, "cde_production")}"`
123
+ if $?.success? then puts "#{Time.now.to_s} - Database restore complete!" else die("Error restoring databse") end
120
124
  puts "Removing database archive file"
121
125
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "rm -rf #{File.join(dump_tmp_path, dump_file_name)}"`
126
+ if $?.success? then puts "#{Time.now.to_s} - Archive removed!" else die("Error removing archive") end
122
127
  puts "#{Time.now.to_s} - Removing saved searches"
123
128
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "mongo cde_production --eval \\"db.users.update({save_searches: {$ne: null}}, {$unset: {save_searches: ''}}, {multi: true})\\""`
129
+ if $?.success? then puts "#{Time.now.to_s} - Saved searches removed" else die("Error removing saved searches") end
124
130
  puts "#{Time.now.to_s} - Cleaning up our mess..."
125
131
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "rm -rf #{File.join(dump_tmp_path, 'cde_production')}"`
132
+ if $?.success? then puts "#{Time.now.to_s} - Mess cleaned up!" else die("Error cleaning up after myself...") end
126
133
  end
127
134
 
128
135
  def terminate(instance_id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mondupe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hutchins