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.
@@ -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
-
@@ -1,13 +0,0 @@
1
- module Befog
2
- module Commands
3
- module Mixins
4
- module Server
5
-
6
- def get_server(id)
7
- compute.servers.get(id)
8
- end
9
-
10
- end
11
- end
12
- end
13
- end
@@ -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