mondupe 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mondupe +12 -12
  3. data/lib/mondupe.rb +2 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f8139a0406c4d85e95e322a4804e657845f9099
4
- data.tar.gz: cc6c8a2673d079d725a5d2eb4d81d3a52b9074e8
3
+ metadata.gz: 6a79d6631458afdf13ec9d697b34bc29c5d22667
4
+ data.tar.gz: 92374bfcbcceba911d3cbbfa4eeae0decf536691
5
5
  SHA512:
6
- metadata.gz: 1871528995cd081a4a1c5a03ba56f991a1a5b3bfba72839326305e22eb62740b24912b84c4607ca350ab69cdac0ee28c801660ec5fea6cf10bb933e20898ab85
7
- data.tar.gz: 6cce9cebaa9192536040905a729c9c08a416f0239909ac20be70a763ddcbbdf6c890656494ea43dc23864ca38e167a8fbe12952749799476e16496bc90823e44
6
+ metadata.gz: 6c5cd79ec61992e07cf46098bfc1051e36d9dcf7449729a693e28cbe23b06a21660e011ab769cd23016a4af74b93a2c97f21b8cac176df0d8919a9a9326fa1fe
7
+ data.tar.gz: 893025cabc05f8eba9c676cd16454b7a818d50d48a88787dd628c26158f83586bb96f75d461edf9bde53b4cd288deae13fb062d56831cfbb5bca311791466acf
data/bin/mondupe CHANGED
@@ -13,21 +13,21 @@ opt_parser = OptionParser.new do |opt|
13
13
  opt.separator "Commands Description"
14
14
  opt.separator " create - create new mongo host."
15
15
  opt.separator " Requires -n [name]"
16
- opt.separator " Optional -i [image] -e [expire_days] -o [owner] -t [type] -a [ipaddress] -s [size]"
16
+ opt.separator " Optional -i [image] -e [expire_days] -o [owner] -t [type] -a [host_address] -s [size]"
17
17
  opt.separator " delete - delete existing mongo host."
18
18
  opt.separator " Requires -n [name] || -d [id]"
19
19
  opt.separator " bootstrap - push chef-client and configuration to the node."
20
- opt.separator " Requires -n [name] -a [ipaddress]"
20
+ opt.separator " Requires -n [name] -a [host_address]"
21
21
  opt.separator " dumps3 - retrieve the database dump from s3."
22
- opt.separator " Requires -n [name] -a [ipaddress]"
22
+ opt.separator " Requires -n [name] -a [host_address]"
23
23
  opt.separator " restore - Restore a mongo dump that exists on a host"
24
- opt.separator " Requires -n [name] -a [ipaddress]"
24
+ opt.separator " Requires -n [name] -a [host_address]"
25
25
  opt.separator " Optional -t [tmpdir] -u [mongo_username] -p [mongo_password] -c [mongo_authdb]"
26
26
  opt.separator " execute - Execute some java script against database"
27
27
  opt.separator " Requires -n [name] -a [dns_address] -x '[javascript]'"
28
28
  opt.separator " Optional -r [db_name]"
29
29
  opt.separator " expire - (coming soon) Reset the expiration days of a node"
30
- opt.separator " Requires ( -n [name] || -d [id] || -a [ipaddress] ) -e [expire_days]"
30
+ opt.separator " Requires ( -n [name] || -d [id] || -a [host_address] ) -e [expire_days]"
31
31
  opt.separator " list - (coming soon) List all mongo hosts."
32
32
  opt.separator " help - Get help."
33
33
  opt.separator ""
@@ -57,8 +57,8 @@ opt_parser = OptionParser.new do |opt|
57
57
  $options[:type] = type
58
58
  end
59
59
 
60
- opt.on("-a","--ipaddress IPADDRESS","IP address of node that already exists. Not to be used with creating new nodes") do |address|
61
- $options[:ipaddress] = address
60
+ opt.on("-a","--address HOST_ADDRESS","IP or DNS address of node that already exists. Not to be used with creating new nodes") do |address|
61
+ $options[:host_address] = address
62
62
  end
63
63
 
64
64
  opt.on("-d","--id INSTANCE_ID","AWS ID of the instance, must exist already") do |id|
@@ -128,7 +128,7 @@ instance_image_id = $options[:image] || ENV['MONDUPE_INSTANCE_IMAGE_ID'] || "ami
128
128
  instance_type = $options[:type] || "m3.xlarge"
129
129
  instance_name = $options[:name] || nil
130
130
  instance_owner = $options[:owner] || ENV['USER'] || 'mondupe'
131
- instance_ipaddress = $options[:ipaddress] || nil
131
+ instance_host_address = $options[:host_address] || nil
132
132
  instance_id = $options[:id] || nil
133
133
  dump_tmp_path = $options[:tmpdir] || '/tmp'
134
134
  expire_days = $options[:expire_days] || 3
@@ -168,16 +168,16 @@ when "delete"
168
168
  when "bootstrap"
169
169
  puts "bootstrapping node"
170
170
  # Find the instance and create the instance object here
171
- Mondupe.new.bootstrap(instance_name, instance_fqdn, instance_ipaddress, chef_environment, chef_identity_file, chef_run_list, ssh_user, knife_exec)
171
+ Mondupe.new.bootstrap(instance_name, instance_fqdn, instance_host_address, chef_environment, chef_identity_file, chef_run_list, ssh_user, knife_exec)
172
172
  when "dumps3"
173
173
  puts "getting dump"
174
- Mondupe.new.get_db_dump_from_s3(instance_ipaddress, s3_bucket_name, dump_tmp_path, ssh_user, dump_file_name)
174
+ Mondupe.new.get_db_dump_from_s3(instance_host_address, s3_bucket_name, dump_tmp_path, ssh_user, dump_file_name)
175
175
  when "restore"
176
176
  puts "Restoring mongo database from dump"
177
- Mondupe.new.restore_db(instance_ipaddress, dump_tmp_path, ssh_key, ssh_user, dump_file_name, mongo_db_name, mongo_user, mongo_pass, mongo_auth_db)
177
+ Mondupe.new.restore_db(instance_host_address, dump_tmp_path, ssh_key, ssh_user, dump_file_name, mongo_db_name, mongo_user, mongo_pass, mongo_auth_db)
178
178
  when 'execute'
179
179
  puts "Executing JS against database"
180
- Mondupe.new.execute_js(instance_ipaddress, ssh_key, ssh_user, java_string, mongo_db_name, mongo_user, mongo_pass, mongo_auth_db)
180
+ Mondupe.new.execute_js(instance_host_address, ssh_key, ssh_user, java_string, mongo_db_name, mongo_user, mongo_pass, mongo_auth_db)
181
181
  when "terminate"
182
182
  puts "Marking instance for termination"
183
183
  Mondupe.new.terminate_instance(instance_id)
data/lib/mondupe.rb CHANGED
@@ -155,7 +155,8 @@ class Mondupe
155
155
  db_connect_string << " --authenticationDatabase \"#{mongo_auth_db}\"" if !mongo_auth_db.nil?
156
156
  puts "Connect String: #{db_connect_string}"
157
157
  puts "#{Time.now.to_s} - Running command on #{instance_dns} against #{mongo_db_name}"
158
- `ssh -i #{ssh_key} #{ssh_user}@#{instance_dns} "echo '#{java_command}' | #{db_connect_string}"`
158
+ db_output = `ssh -i #{ssh_key} #{ssh_user}@#{instance_dns} "echo '#{java_command}' | #{db_connect_string}"`
159
+ puts db_output
159
160
  if $?.success? then puts "#{Time.now.to_s} - Command execution complete" else abort("Error executing command") end
160
161
  end
161
162
 
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.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hutchins