befog 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/befog.rb
CHANGED
data/lib/befog/cli.rb
CHANGED
@@ -50,6 +50,13 @@ module Befog
|
|
50
50
|
|
51
51
|
def self.run(arguments)
|
52
52
|
subcommand = arguments.shift
|
53
|
+
# TODO: Rejigger this so we can have top-level options
|
54
|
+
# instead of special-casing --version
|
55
|
+
if subcommand == "--version" or subcommand == "-v"
|
56
|
+
Befog.show_version
|
57
|
+
exit if arguments.empty?
|
58
|
+
subcommand = arguments.shift
|
59
|
+
end
|
53
60
|
if subcommand && (command = COMMANDS[subcommand])
|
54
61
|
command.run(CLI.parse(arguments))
|
55
62
|
elsif subcommand
|
@@ -42,7 +42,7 @@ module Befog
|
|
42
42
|
|
43
43
|
option :keypair,
|
44
44
|
:short => :x,
|
45
|
-
:description => "The
|
45
|
+
:description => "The cloud provider SSH key pair name to use with the instances in this bank"
|
46
46
|
|
47
47
|
option :group,
|
48
48
|
:short => :g,
|
@@ -70,4 +70,4 @@ module Befog
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
|
-
end
|
73
|
+
end
|
@@ -35,7 +35,9 @@ module Befog
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def save
|
38
|
-
|
38
|
+
# Make sure we load the configuration before opening the file for writing
|
39
|
+
configuration_for_writing = _configuration
|
40
|
+
File.open(configuration_path,"w") { |f| YAML.dump(configuration_for_writing,f) }
|
39
41
|
$stdout.puts "Configuration written to: #{configuration_path}"
|
40
42
|
end
|
41
43
|
|
@@ -40,18 +40,18 @@ module Befog
|
|
40
40
|
end
|
41
41
|
run_for_selected do |id|
|
42
42
|
if options[:all] or count > 0
|
43
|
-
threads << Thread.new do
|
43
|
+
# threads << Thread.new do
|
44
44
|
safely do
|
45
45
|
log "Deprovisioning server #{id} ..."
|
46
46
|
compute.servers.get(id).destroy
|
47
47
|
deleted << id
|
48
48
|
count -= 1
|
49
49
|
end
|
50
|
-
end
|
50
|
+
# end
|
51
51
|
end
|
52
52
|
end
|
53
53
|
$stdout.print "This may take a few minutes .."
|
54
|
-
sleep 1 while threads.any? { |t| $stdout.print "."; $stdout.flush ; t.alive? }
|
54
|
+
# sleep 1 while threads.any? { |t| $stdout.print "."; $stdout.flush ; t.alive? }
|
55
55
|
$stdout.print "\n"
|
56
56
|
self.servers -= deleted
|
57
57
|
save
|
data/lib/befog/commands/start.rb
CHANGED