auser-poolparty 0.2.44 → 0.2.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/Manifest.txt +3 -1
  2. data/bin/cloud +11 -21
  3. data/bin/cloud-add-keypair +18 -13
  4. data/bin/cloud-configure +3 -11
  5. data/bin/cloud-contract +7 -12
  6. data/bin/cloud-ensure-provisioning +2 -11
  7. data/bin/cloud-expand +3 -10
  8. data/bin/cloud-handle-load +3 -9
  9. data/bin/cloud-list +3 -9
  10. data/bin/cloud-maintain +2 -9
  11. data/bin/cloud-osxcopy +3 -9
  12. data/bin/cloud-provision +4 -9
  13. data/bin/cloud-refresh +2 -9
  14. data/bin/cloud-run +3 -4
  15. data/bin/cloud-ssh +3 -2
  16. data/bin/cloud-start +7 -13
  17. data/bin/cloud-terminate +4 -7
  18. data/bin/pool +11 -12
  19. data/bin/pool-describe +0 -1
  20. data/bin/pool-list +3 -9
  21. data/bin/pool-start +3 -10
  22. data/generators/poolspec/USAGE +2 -2
  23. data/generators/poolspec/poolspec_generator.rb +2 -1
  24. data/generators/poolspec/templates/pool_spec_template.erb +3 -2
  25. data/lib/erlang/messenger/useful_snippets +2 -2
  26. data/lib/poolparty/aska/aska.rb +5 -6
  27. data/lib/poolparty/base_packages/haproxy.rb +2 -2
  28. data/lib/poolparty/core/string.rb +1 -1
  29. data/lib/poolparty/exceptions/CloudNotFoundException.rb +7 -0
  30. data/lib/poolparty/helpers/binary.rb +1 -1
  31. data/lib/poolparty/helpers/optioner.rb +34 -12
  32. data/lib/poolparty/modules/cloud_dsl.rb +13 -0
  33. data/lib/poolparty/net/messenger.rb +1 -1
  34. data/lib/poolparty/net/remote_bases/ec2.rb +162 -145
  35. data/lib/poolparty/net/remoter.rb +8 -4
  36. data/lib/poolparty/plugins/git.rb +5 -1
  37. data/lib/poolparty/pool/base.rb +1 -1
  38. data/lib/poolparty/pool/cloud.rb +7 -2
  39. data/lib/poolparty/pool/resource.rb +1 -1
  40. data/lib/poolparty/pool/resources/mount.rb +22 -0
  41. data/lib/poolparty/version.rb +1 -1
  42. data/poolparty.gemspec +5 -4
  43. data/spec/poolparty/modules/configurable_spec.rb +4 -1
  44. data/spec/poolparty/pool/base_spec.rb +2 -2
  45. data/spec/poolparty/pool/plugin_model_spec.rb +2 -3
  46. data/website/index.html +1 -1
  47. metadata +5 -4
  48. data/bin/pool-provision +0 -34
data/Manifest.txt CHANGED
@@ -25,7 +25,6 @@ bin/pool
25
25
  bin/pool-console
26
26
  bin/pool-describe
27
27
  bin/pool-list
28
- bin/pool-provision
29
28
  bin/pool-spec
30
29
  bin/pool-start
31
30
  bin/server-build-messenger
@@ -311,6 +310,7 @@ lib/poolparty/core/symbol.rb
311
310
  lib/poolparty/core/time.rb
312
311
  lib/poolparty/dependency_resolutions/base.rb
313
312
  lib/poolparty/dependency_resolutions/puppet.rb
313
+ lib/poolparty/exceptions/CloudNotFoundException.rb
314
314
  lib/poolparty/exceptions/LoadRulesException.rb
315
315
  lib/poolparty/exceptions/MasterException.rb
316
316
  lib/poolparty/exceptions/RemoteException.rb
@@ -326,6 +326,7 @@ lib/poolparty/helpers/optioner.rb
326
326
  lib/poolparty/helpers/provisioner_base.rb
327
327
  lib/poolparty/helpers/provisioners/master.rb
328
328
  lib/poolparty/helpers/provisioners/slave.rb
329
+ lib/poolparty/modules/cloud_dsl.rb
329
330
  lib/poolparty/modules/cloud_resourcer.rb
330
331
  lib/poolparty/modules/configurable.rb
331
332
  lib/poolparty/modules/definable_resource.rb
@@ -365,6 +366,7 @@ lib/poolparty/pool/resources/exec.rb
365
366
  lib/poolparty/pool/resources/file.rb
366
367
  lib/poolparty/pool/resources/gem_package.rb
367
368
  lib/poolparty/pool/resources/host.rb
369
+ lib/poolparty/pool/resources/mount.rb
368
370
  lib/poolparty/pool/resources/package.rb
369
371
  lib/poolparty/pool/resources/remote_file.rb
370
372
  lib/poolparty/pool/resources/service.rb
data/bin/cloud CHANGED
@@ -3,28 +3,18 @@ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
5
 
6
- # # Get the git-style program action
7
- # o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
8
- # opts.on('-n [name]','--name [name]', 'Binary to run') { |o| optioner.name o }
9
- #
10
- # opts.banner = <<-EOB
11
- # Usage: cloud <specfile> <action> <options>
12
- # Cloud actions:
13
- # #{Binary.list_binaries_for("cloud")}
14
- # EOB
15
- # end
6
+ name = ARGV.select {|arg| arg if Binary.available_binaries_for("cloud").include?(arg) }.first
7
+ # If the options include -h and they don't include a valid command, then we can just pass the
8
+ # original options back, but if they do contain a binary, we don't want -h getting through to
9
+ # these options, so we'll strip it if it's included
10
+ DUP_ARG = ARGV.dup
11
+ new_args = DUP_ARG.reject {|arg| Binary.available_binaries_for("cloud").include?(arg) }.empty? ? ARGV : (name ? (DUP_ARG.delete("-h"); DUP_ARG) : DUP_ARG)
16
12
 
17
- name = ARGV.shift
13
+ # Let's make sure if no command is passed in that we show the help message
14
+ new_args.push("-h") unless name
18
15
 
19
- # If there was no program action given
20
- if !name || name == "-h" || name == "--help"
21
- puts "Binary required"
22
- puts <<-EOB
23
- Usage: cloud <specfile> <action> <options>
24
- Cloud actions:
25
- #{Binary.list_binaries_for("cloud")}
26
- EOB
27
- exit
16
+ o = PoolParty::Optioner.new(new_args, {:extra_help => "\nCloud actions\n#{Binary.list_binaries_for("cloud")}\n\n", :abstract => true}) do |opts, optioner|
17
+ opts.on('-n cloudname', '--name name', 'Address this cloud') { |c| optioner.cloudname c }
28
18
  end
29
19
 
30
20
  program_name = "#{File.basename($0)}-#{name}"
@@ -36,5 +26,5 @@ command_line = "#{program_location}"
36
26
  if Binary.available_binaries_for("cloud").include?(name)
37
27
  system command_line, *ARGV
38
28
  else
39
- puts "Unknown poolparty binary: #{program_name}"
29
+ puts "Unknown poolparty binary: #{name}"
40
30
  end
@@ -2,22 +2,27 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
- opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
7
+ opts.on('-n name', '--name name', 'Add the keypair for cloud name') { |c| optioner.cloudname c }
8
+ opts.on('-l', '--listing', 'List the keypairs for the clouds') { optioner.listkeys true }
7
9
  end
8
- load_pool(o.spec || Binary.get_existing_spec_location)
9
-
10
- @location = o.location ? o.location : "remote"
11
-
12
- include Remote
13
10
 
14
- @clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
15
-
16
- @clouds.each do |name, cloud|
11
+ if o.listkeys
12
+
13
+ puts "Cloud\t\tKeypair"
14
+ puts "--------------------------"
15
+ o.loaded_clouds.each do |cloud|
16
+ puts "#{cloud.name}\t--\t#{cloud.keypair}"
17
+ end
18
+
19
+ else
17
20
 
18
- with_cloud(cloud, {:location => @location, :verbose => o.verbose}) do
19
- vputs header("Creating keypair for #{name}")
20
- create_keypair unless testing
21
- end
21
+ o.loaded_clouds.each do |cloud|
22
+ with_cloud(cloud) do
23
+ vputs header("Creating keypair for #{name}")
24
+ create_keypair unless testing
25
+ end
26
+ end
22
27
 
23
28
  end
data/bin/cloud-configure CHANGED
@@ -2,21 +2,13 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
- opts.on('-c [master|slaves|all]', '--class [master|slaves|all]', 'Provision class (default: all)') { |c| optioner.provision_class c }
7
- opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
8
7
  end
9
- load_pool(o.spec || Binary.get_existing_spec_location)
10
-
11
- @provision_class = o.provision_class || "all"
12
-
13
- include Remote
14
-
15
- @clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
16
8
 
17
- @clouds.each do |name, cloud|
9
+ o.loaded_clouds.each do |cloud|
18
10
 
19
- with_cloud(cloud, {:testing => o.testing, :location => @location, :provision_class => @provision_class, :verbose => o.verbose}) do
11
+ with_cloud(cloud) do
20
12
 
21
13
  # hide_output do
22
14
  # if provision_class == "master" || provision_class == "all"
data/bin/cloud-contract CHANGED
@@ -6,17 +6,12 @@ require "poolpartycl"
6
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
7
7
  opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
8
8
  end
9
- load_pool(o.spec || Binary.get_existing_spec_location)
10
9
 
11
- @testing = o.testing
12
-
13
- include Remote
14
-
15
- @cloud = extract_cloud_from_options(o).first
16
-
17
- with_cloud(@cloud, {:testing => @testing}) do
18
- puts header("Contracting cloud #{name}")
19
- puts "#{list_of_running_instances.size} running instances (#{minimum_instances} minimum instances)"
20
- puts testing ? "Not contracting (test mode)" : "Contracting the cloud if possible"
21
- contract_cloud_if_necessary( !testing )
10
+ o.loaded_clouds.each do |cl|
11
+ with_cloud(cl) do
12
+ puts header("Contracting cloud #{name}")
13
+ puts "#{list_of_running_instances.size} running instances (#{minimum_instances} minimum instances)"
14
+ puts testing ? "Not contracting (test mode)" : "Contracting the cloud if possible"
15
+ contract_cloud_if_necessary( !testing )
16
+ end
22
17
  end
@@ -8,21 +8,12 @@ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
8
8
  opts.on('-n name', '--name name', 'Host name') { |h| optioner.hostname h }
9
9
  opts.on('-l', '--no-shell', 'No shell') {optioner.noshell true}
10
10
  end
11
-
12
- load_pool(o.spec || Binary.get_existing_spec_location)
13
-
14
- include Remote
15
-
16
- @clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
17
11
  @hostname = o.hostname ? o.hostname : `hostname`.chomp
18
-
19
12
  @hostname = "node0" if @hostname == "master" # Quick fix to make sure we have a node running on the master as well
20
13
 
21
- @clouds.each do |name, cloud|
14
+ o.loaded_clouds.each do |cloud|
22
15
 
23
- with_cloud(cloud, {:testing => o.testing, :hostname => @hostname, :noshell => o.noshell }) do
24
- # TODO: Change this to be app specfic
25
- # SECURITY RISK
16
+ with_cloud(cloud, {:hostname => @hostname}) do
26
17
 
27
18
  boot_file = "#{Messenger.append_dir}/pm_node_rel-0.1"
28
19
  command = Messenger.erl_command(hostname, "-boot #{boot_file} #{noshell ? "" : "-detached -heart"}")
data/bin/cloud-expand CHANGED
@@ -4,19 +4,12 @@ require "poolparty"
4
4
  require "poolpartycl"
5
5
 
6
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
7
- opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
7
+ opts.on('-n name', '--name name', 'Expand the cloud on this name') { |c| optioner.cloudname c }
8
8
  end
9
- load_pool(o.spec || Binary.get_existing_spec_location)
10
9
 
11
- @testing = o.testing
10
+ o.loaded_clouds.each do |cloud|
12
11
 
13
- include Remote
14
-
15
- @clouds = extract_cloud_from_options o
16
-
17
- @clouds.each do |cloud|
18
-
19
- with_cloud(cloud, {:testing => @testing, :verbose => o.verbose}) do
12
+ with_cloud(cloud) do
20
13
  vputs header("Expanding cloud #{name}")
21
14
  vputs "#{list_of_running_instances.size} running instances of #{maximum_instances} possible instances"
22
15
  vputs testing ? "Not expanding (test mode)" : "Expanding the cloud"
@@ -2,20 +2,14 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
7
  opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
7
8
  end
8
- load_pool(o.spec || Binary.get_existing_spec_location)
9
-
10
- @location = o.location ? o.location : "remote"
11
-
12
- include Remote
13
-
14
- @clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
15
9
 
16
- @clouds.each do |name, cloud|
10
+ o.loaded_clouds.each do |cloud|
17
11
 
18
- with_cloud(cloud, {:location => @location, :testing => o.testing, :verbose => o.verbose}) do
12
+ with_cloud(cloud) do
19
13
  vputs header("Load handling cloud #{name}")
20
14
  if should_expand_cloud?
21
15
  vputs "Expanding cloud based on load"
data/bin/cloud-list CHANGED
@@ -2,23 +2,17 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
7
  opts.on('-f [remote|local]', '--from [remote|local]', 'Remote or local (default: local)') { |o| optioner.location o }
7
8
  opts.on('-r', '--remote', 'Remote listing') { optioner.location "remote" }
8
9
  opts.on('-l', '--local', 'Local listing') { optioner.location "local" }
9
10
  opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
10
11
  end
11
- load_pool(o.spec || Binary.get_existing_spec_location)
12
-
13
- @location = o.location ? o.location : "remote"
14
-
15
- include Remote
16
-
17
- @clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
18
12
 
19
- @clouds.each do |name, cloud|
13
+ o.loaded_clouds.each do |cloud|
20
14
 
21
- with_cloud(cloud, {:location => @location}) do
15
+ with_cloud(cloud) do
22
16
  puts header("Listing cloud #{name}")
23
17
  puts subheader("Active instances")
24
18
  puts list_of_running_instances.map{|a| a.to_s}.join("\n")
data/bin/cloud-maintain CHANGED
@@ -8,17 +8,10 @@ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
8
8
  opts.on('-l', '--local', 'Local listing') { optioner.location "local" }
9
9
  opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
10
10
  end
11
- load_pool(o.spec || Binary.get_existing_spec_location)
12
11
 
13
- @location = o.location ? o.location : "remote"
12
+ o.loaded_clouds.each do |cloud|
14
13
 
15
- include Remote
16
-
17
- @clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
18
-
19
- @clouds.each do |name, cloud|
20
-
21
- with_cloud(cloud, {:location => @location, :testing => o.testing, :verbose => o.verbose}) do
14
+ with_cloud(cloud) do
22
15
  vputs header("Maintaining cloud #{name}")
23
16
  logger.warn "Maintaining cloud"
24
17
  logger.warn rules_values
data/bin/cloud-osxcopy CHANGED
@@ -2,18 +2,12 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
- opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
7
+ opts.on('-n name', '--name name', 'Copy the master ip for this cloud') { |c| optioner.cloudname c }
7
8
  end
8
- load_pool(o.spec || Binary.get_existing_spec_location)
9
-
10
- @location = o.location ? o.location : "remote"
11
-
12
- include Remote
13
-
14
- @clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
15
9
 
16
- @clouds.each do |name, cloud|
10
+ o.loaded_clouds.each do |cloud|
17
11
 
18
12
  with_cloud(cloud, {:location => @location}) do
19
13
  Kernel.system "echo #{master.ip.chomp} | pbcopy"
data/bin/cloud-provision CHANGED
@@ -2,20 +2,15 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
- opts.on('-s', '--slave', 'Provision slave (default: false)') { optioner.provision_slave true }
7
+ opts.on('-p', '--slave', 'Provision slave (default: false)') { optioner.provision_slave true }
7
8
  opts.on('-i num', '--id num', 'Instance num to provision') { |i| optioner.instance_num i }
8
9
  end
9
10
 
10
- load_pool(o.spec || Binary.get_existing_spec_location)
11
-
12
- include Remote
13
-
14
- @clouds = extract_cloud_from_options o
15
-
16
- @clouds.each do |cloud|
11
+ o.loaded_clouds.each do |cloud|
17
12
 
18
- with_cloud(cloud, {:verbose => o.verbose, :testing => o.testing, :provision_slave => (o.provision_slave || false), :instance_number => o.instance_num}) do
13
+ with_cloud(cloud) do
19
14
 
20
15
  instance_num = instance_number.to_i if instance_number
21
16
 
data/bin/cloud-refresh CHANGED
@@ -6,17 +6,10 @@ require "poolpartycl"
6
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
7
7
  opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
8
8
  end
9
- load_pool(o.spec || Binary.get_existing_spec_location)
10
9
 
11
- @provision_class = o.provision_class || "all"
12
-
13
- include Remote
14
-
15
- @clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
16
-
17
- @clouds.each do |name, cloud|
10
+ o.loaded_clouds.each do |cloud|
18
11
 
19
- with_cloud(cloud, {:testing => o.testing}) do
12
+ with_cloud(cloud) do
20
13
  cmd = <<-EOE
21
14
  puppetrun --host #{list_of_node_names.join(", --host ")}
22
15
  EOE
data/bin/cloud-run CHANGED
@@ -11,9 +11,8 @@ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
11
11
  opts.on('-c command', '--command command', 'Command to run on the instance') { |c| optioner.command c }
12
12
  end
13
13
 
14
- load_pool(o.spec || Binary.get_existing_spec_location)
15
-
16
14
  @cmd = o.command if (o.command)
17
- @cloud = o.cloudname ? cloud(o.cloudname.downcase.to_sym) : cloud(clouds.keys.first)
18
15
 
19
- instance = @cloud.run_command_on_instance_number( @cmd, o.num.to_i || 0 ) if @cloud
16
+ o.loaded_clouds.each do |cl|
17
+ @cloud.run_command_on_instance_number( @cmd, o.num.to_i || 0 ) if @cloud
18
+ end
data/bin/cloud-ssh CHANGED
@@ -2,12 +2,13 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
7
  opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
7
8
  opts.on('-i num', '--id num', 'Instance num to ssh (default: 0)') { |i| optioner.num i }
8
9
  end
9
10
  load_pool(o.spec || Binary.get_existing_spec_location)
10
11
 
11
- @cloud = o.cloudname ? cloud(o.cloudname.downcase.to_sym) : cloud(clouds.keys.first)
12
+ @cloud = o.loaded_clouds.first
12
13
 
13
- instance = @cloud.ssh_into_instance_number( o.num.to_i || 0 ) if @cloud
14
+ @cloud.ssh_into_instance_number( o.num.to_i || 0 ) if @cloud
data/bin/cloud-start CHANGED
@@ -2,21 +2,15 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
- opts.on('-c cloudname', '--cloud name', 'Start cloud by this name') { |c| optioner.cloudname c }
7
+ opts.on('-n cloudname', '--name name', 'Start cloud by this name') { |c| optioner.cloudname c }
7
8
  end
8
9
 
9
- load_pool(o.spec || Binary.get_existing_spec_location)
10
-
11
- @testing = o.testing
12
-
13
- @clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
14
-
15
- @clouds.each do |name, cloud|
16
-
17
- with_cloud(cloud, {:testing => @testing, :verbose => (o.verbose || false)}) do
18
- puts header("Starting cloud")
19
- puts "#{list_of_running_instances.size} running instances (#{minimum_instances} - #{maximum_instances})"
10
+ o.loaded_clouds.each do |cloud|
11
+ with_cloud(cloud) do
12
+ vputs header("Starting cloud")
13
+ vputs "#{list_of_running_instances.size} running instances (#{minimum_instances} - #{maximum_instances})"
20
14
  if list_of_running_instances.size <= 1
21
15
  puts "Starting the master instance"
22
16
  if testing
@@ -28,7 +22,7 @@ load_pool(o.spec || Binary.get_existing_spec_location)
28
22
  provisioning_complete
29
23
  end
30
24
  end
31
- puts open(::File.join(File.dirname(__FILE__), "..", "lib", "poolparty", "config", "postlaunchmessage.txt")).read ^ {:master_ip => master.ip.chomp}
25
+ vputs open(::File.join(File.dirname(__FILE__), "..", "lib", "poolparty", "config", "postlaunchmessage.txt")).read ^ {:master_ip => master.ip.chomp}
32
26
  clear_base_directory unless testing
33
27
  end
34
28
 
data/bin/cloud-terminate CHANGED
@@ -2,17 +2,14 @@
2
2
  $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
+
5
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
6
- opts.on('-c [master|slaves|all]', '--class [master|slaves|all]', 'Provision class (default: all)') { |c| optioner.provision_class c }
7
- opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
7
+ opts.on('-n name', '--name name', 'Terminate the cloud of this name') { |c| optioner.cloudname c }
8
8
  end
9
- load_pool(o.spec || Binary.get_existing_spec_location)
10
-
11
- @clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
12
9
 
13
- @clouds.each do |name, cloud|
10
+ o.loaded_clouds.each do |cloud|
14
11
 
15
- with_cloud(cloud, {:testing => o.testing, :location => @location, :provision_class => @provision_class}) do
12
+ with_cloud(cloud) do
16
13
 
17
14
  list_of_running_instances.each do |inst|
18
15
  puts "Shutting down #{inst.instance_id}"