mondupe 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mondupe +1 -1
  3. data/lib/mondupe.rb +6 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 537a81e5200338fa09374211defb7e408374e0af
4
- data.tar.gz: 2527234dca42a179549f2313c411b9d9fd02ff51
3
+ metadata.gz: 14039c9391a91da785e7e8b837a23fd7d6eab971
4
+ data.tar.gz: 585a0cea931df1fc3e5d580e8344c88369c38754
5
5
  SHA512:
6
- metadata.gz: d5c0c4b6a3fc33e4458d639d67e52cff60f4d71f21e3695b8b03a813fcc88077bdd511665cef7f9f1edca0adc5be8cb3bec97b77b826e5fd15a82e040823291c
7
- data.tar.gz: 7fb401302c1826fbab4f916ff97abc0e00a54894e07d684f264e6d9bb1276bc577891b1bd6cb67d63fe737fc9ce179f5fde94e3955f9f043bdabce165b3dffba
6
+ metadata.gz: 4bb20d98cc526259c70aa8dfd8d218ced240a66be6e3c3d6a062d7990306c61bc14a44b6603340c12ff2f5783daa1e2c24b0be8f55314da6f4eea5e6102a5c22
7
+ data.tar.gz: e0e33aec7535e6400b8f5524b50a6ee54a7381d788583930c831729f7b971447531c5f19168f5e7d4b4a49c95179695eeb8b85d3f2fb022fa505dace4f65ee86
data/bin/mondupe CHANGED
@@ -5,7 +5,7 @@ require 'optparse'
5
5
 
6
6
  $options = {}
7
7
 
8
- ValidHostnameRegex=/(?!-)[A-Z\d-]{1,63}(?<!-)$/
8
+ ValidHostnameRegex=/(?![0-9]+$)(?!-)[a-zA-Z0-9-]{,63}(?<!-)/
9
9
 
10
10
  opt_parser = OptionParser.new do |opt|
11
11
  opt.banner = "Usage: mondupe COMMAND [OPTIONS]"
data/lib/mondupe.rb CHANGED
@@ -121,22 +121,22 @@ class Mondupe
121
121
  # TODO - Fail the process if any step fails
122
122
  puts "#{Time.now.to_s} - Dropping existing database"
123
123
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "echo 'db.dropDatabase()' | mongo cde_production"`
124
- if $?.success? then puts "#{Time.now.to_s} - Database drop complete" else die("Error dropping database") end
124
+ if $?.success? then puts "#{Time.now.to_s} - Database drop complete" else abort("Error dropping database") end
125
125
  puts "Extracting database dump archive file..."
126
126
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "cd #{dump_tmp_path}; tar xf #{dump_file_name}"`
127
- if $?.success? then puts "#{Time.now.to_s} - Extraction complete!" else die("Error extracting archive") end
127
+ if $?.success? then puts "#{Time.now.to_s} - Extraction complete!" else abort("Error extracting archive") end
128
128
  puts "Restoring Mongo Database from extracted dump: #{File.join(dump_tmp_path, "cde_production")}"
129
129
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "time mongorestore #{File.join(dump_tmp_path, "cde_production")}"`
130
- if $?.success? then puts "#{Time.now.to_s} - Database restore complete!" else die("Error restoring databse") end
130
+ if $?.success? then puts "#{Time.now.to_s} - Database restore complete!" else abort("Error restoring databse") end
131
131
  puts "Removing database archive file"
132
132
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "rm -rf #{File.join(dump_tmp_path, dump_file_name)}"`
133
- if $?.success? then puts "#{Time.now.to_s} - Archive removed!" else die("Error removing archive") end
133
+ if $?.success? then puts "#{Time.now.to_s} - Archive removed!" else abort("Error removing archive") end
134
134
  puts "#{Time.now.to_s} - Removing saved searches"
135
135
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "mongo cde_production --eval \\"db.users.update({save_searches: {$ne: null}}, {$unset: {save_searches: ''}}, {multi: true})\\""`
136
- if $?.success? then puts "#{Time.now.to_s} - Saved searches removed" else die("Error removing saved searches") end
136
+ if $?.success? then puts "#{Time.now.to_s} - Saved searches removed" else abort("Error removing saved searches") end
137
137
  puts "#{Time.now.to_s} - Cleaning up our mess..."
138
138
  `ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "rm -rf #{File.join(dump_tmp_path, 'cde_production')}"`
139
- if $?.success? then puts "#{Time.now.to_s} - Mess cleaned up!" else die("Error cleaning up after myself...") end
139
+ if $?.success? then puts "#{Time.now.to_s} - Mess cleaned up!" else abort("Error cleaning up after myself...") end
140
140
  end
141
141
 
142
142
  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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hutchins