befog 0.3.0 → 0.4.0
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.
- data/bin/befog +12 -11
- data/lib/befog/cli.rb +40 -33
- data/lib/befog/commands/add.rb +64 -30
- data/lib/befog/commands/configure.rb +27 -40
- data/lib/befog/commands/list.rb +17 -55
- data/lib/befog/commands/mixins/command.rb +52 -45
- data/lib/befog/commands/mixins/configurable.rb +9 -9
- data/lib/befog/commands/mixins/help.rb +2 -4
- data/lib/befog/commands/mixins/safely.rb +28 -0
- data/lib/befog/commands/mixins/scope.rb +127 -0
- data/lib/befog/commands/mixins/selectable.rb +62 -0
- data/lib/befog/commands/mixins/traceable.rb +29 -0
- data/lib/befog/commands/remove.rb +36 -31
- data/lib/befog/commands/run.rb +31 -23
- data/lib/befog/commands/start.rb +21 -18
- data/lib/befog/commands/stop.rb +17 -19
- data/lib/befog.rb +1 -0
- metadata +24 -37
- data/lib/befog/commands/mixins/bank.rb +0 -50
- data/lib/befog/commands/mixins/provider.rb +0 -40
- data/lib/befog/commands/mixins/server.rb +0 -13
- data/lib/befog/providers/aws.rb +0 -20
@@ -1,50 +0,0 @@
|
|
1
|
-
module Befog
|
2
|
-
module Commands
|
3
|
-
module Mixins
|
4
|
-
module Bank
|
5
|
-
|
6
|
-
def banks
|
7
|
-
configuration["banks"] ||= {}
|
8
|
-
end
|
9
|
-
|
10
|
-
def _bank
|
11
|
-
raise Befog::CLI::Error.new("You must specify a bank to do this") unless options[:bank]
|
12
|
-
banks[options[:bank]] ||= {}
|
13
|
-
end
|
14
|
-
|
15
|
-
def bank
|
16
|
-
_bank["configuration"] ||= {}
|
17
|
-
end
|
18
|
-
|
19
|
-
def servers
|
20
|
-
_bank["servers"] ||= []
|
21
|
-
end
|
22
|
-
|
23
|
-
def process_arguments(arguments)
|
24
|
-
_bank,*rest = arguments
|
25
|
-
if _bank.nil? or _bank =~ /^\-/
|
26
|
-
super
|
27
|
-
else
|
28
|
-
super(rest)
|
29
|
-
options[:bank] = _bank
|
30
|
-
bank.each do |key,value|
|
31
|
-
options[key.to_sym] ||= value
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def run_for_each_server
|
37
|
-
if servers.empty?
|
38
|
-
$stderr.puts "No servers are in bank '#{options[:bank]}'."
|
39
|
-
return
|
40
|
-
end
|
41
|
-
servers.each do |id|
|
42
|
-
run_for_server(id)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require "befog/providers/aws"
|
2
|
-
|
3
|
-
module Befog
|
4
|
-
module Commands
|
5
|
-
module Mixins
|
6
|
-
module Provider
|
7
|
-
|
8
|
-
PROVIDERS = {
|
9
|
-
"aws" => Befog::Providers::AWS
|
10
|
-
}
|
11
|
-
|
12
|
-
def providers
|
13
|
-
configuration["providers"] ||= {}
|
14
|
-
end
|
15
|
-
|
16
|
-
def provider
|
17
|
-
raise Befog::CLI::Error.new("You must specify a provider (with --provider or -q) to do this") unless options[:provider]
|
18
|
-
providers[options[:provider]] ||= {}
|
19
|
-
end
|
20
|
-
|
21
|
-
def regions
|
22
|
-
provider["regions"] ||= {}
|
23
|
-
end
|
24
|
-
|
25
|
-
def region
|
26
|
-
raise Befog::CLI::Error.new("Please set the region using -r or --region.") unless options[:region]
|
27
|
-
regions[options[:region]] ||= {}
|
28
|
-
end
|
29
|
-
|
30
|
-
def compute(provider=nil)
|
31
|
-
provider ||= options[:provider]
|
32
|
-
@compute ||= PROVIDERS[provider].compute(providers[provider])
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
|
data/lib/befog/providers/aws.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "fog"
|
2
|
-
Excon.defaults[:ssl_verify_peer] = false
|
3
|
-
|
4
|
-
module Befog
|
5
|
-
|
6
|
-
module Providers
|
7
|
-
|
8
|
-
class AWS
|
9
|
-
|
10
|
-
def self.compute(configuration)
|
11
|
-
Fog::Compute.new(:provider => "AWS",
|
12
|
-
:aws_access_key_id => configuration["key"],
|
13
|
-
:aws_secret_access_key => configuration["secret"])
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|