fog-core 1.31.1 → 1.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +5 -0
- data/lib/fog/account.rb +4 -17
- data/lib/fog/baremetal.rb +1 -26
- data/lib/fog/billing.rb +4 -21
- data/lib/fog/cdn.rb +1 -26
- data/lib/fog/compute.rb +4 -23
- data/lib/fog/core.rb +3 -0
- data/lib/fog/core/services_mixin.rb +43 -0
- data/lib/fog/core/version.rb +1 -1
- data/lib/fog/dns.rb +4 -19
- data/lib/fog/identity.rb +1 -23
- data/lib/fog/image.rb +1 -26
- data/lib/fog/metering.rb +1 -26
- data/lib/fog/monitoring.rb +4 -21
- data/lib/fog/network.rb +4 -21
- data/lib/fog/orchestration.rb +1 -26
- data/lib/fog/storage.rb +4 -19
- data/lib/fog/support.rb +4 -21
- data/lib/fog/volume.rb +1 -26
- data/lib/fog/vpn.rb +4 -21
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cce0c130a1aade8f7c0b37686d8c4373108cdb96
|
4
|
+
data.tar.gz: d139b954306ca369a9ec3a27ef6a1b3534049f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b42044e5b7f6ec5cb1c8d10b5f26d0cd18fbb311b406e1d710d25b32f7644b0780626a872b0bc91d5cef08035a1032f194a3d77aeb02e48bf37560b3d0030d80
|
7
|
+
data.tar.gz: 4ef2091abaac8996facfeceebaabadcc8f6ef661b75b4ee6dbeee145ddd5c04289be2aa0bfe38e3cf6dcb7cfbc6057cc272b182d7f0449ac94b1ff30544f8259
|
data/changelog.md
CHANGED
data/lib/fog/account.rb
CHANGED
@@ -1,29 +1,16 @@
|
|
1
1
|
module Fog
|
2
2
|
module Account
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup
|
9
7
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
|
11
9
|
if provider == :stormondemand
|
12
10
|
require "fog/account/storm_on_demand"
|
13
11
|
Fog::Account::StormOnDemand.new(attributes)
|
14
|
-
elsif providers.include?(provider)
|
15
|
-
begin
|
16
|
-
require "fog/#{provider}/account"
|
17
|
-
begin
|
18
|
-
Fog::Account.const_get(Fog.providers[provider])
|
19
|
-
rescue
|
20
|
-
Fog.const_get(Fog.providers[provider])::Account
|
21
|
-
end.new(attributes)
|
22
|
-
rescue
|
23
|
-
raise ArgumentError, "#{provider} has no account service"
|
24
|
-
end
|
25
12
|
else
|
26
|
-
|
13
|
+
super(orig_attributes)
|
27
14
|
end
|
28
15
|
end
|
29
16
|
|
data/lib/fog/baremetal.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Baremetal
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.new(attributes)
|
8
|
-
attributes = attributes.dup # Prevent delete from having side effects
|
9
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
-
if providers.include?(provider)
|
11
|
-
begin
|
12
|
-
require "fog/#{provider}/baremetal"
|
13
|
-
begin
|
14
|
-
Fog::Baremetal.const_get(Fog.providers[provider])
|
15
|
-
rescue
|
16
|
-
Fog.const_get(Fog.providers[provider])::Baremetal
|
17
|
-
end.new(attributes)
|
18
|
-
rescue
|
19
|
-
raise ArgumentError, "#{provider} has no baremetal service"
|
20
|
-
end
|
21
|
-
else
|
22
|
-
raise ArgumentError, "#{provider} is not a recognized provider"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.providers
|
27
|
-
Fog.services[:baremetal]
|
28
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
29
4
|
end
|
30
5
|
end
|
data/lib/fog/billing.rb
CHANGED
@@ -1,33 +1,16 @@
|
|
1
1
|
module Fog
|
2
2
|
module Billing
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup
|
9
7
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
if provider == :stormondemand
|
11
9
|
require "fog/billing/storm_on_demand"
|
12
10
|
Fog::Billing::StormOnDemand.new(attributes)
|
13
|
-
elsif providers.include?(provider)
|
14
|
-
begin
|
15
|
-
require "fog/#{provider}/billing"
|
16
|
-
begin
|
17
|
-
Fog::Account.const_get(Fog.providers[provider])
|
18
|
-
rescue
|
19
|
-
Fog.const_get(Fog.providers[provider])::Account
|
20
|
-
end.new(attributes)
|
21
|
-
rescue
|
22
|
-
raise ArgumentError, "#{provider} has no billing service"
|
23
|
-
end
|
24
11
|
else
|
25
|
-
|
12
|
+
super(orig_attributes)
|
26
13
|
end
|
27
14
|
end
|
28
|
-
|
29
|
-
def self.providers
|
30
|
-
Fog.services[:billing]
|
31
|
-
end
|
32
15
|
end
|
33
16
|
end
|
data/lib/fog/cdn.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module CDN
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.new(attributes)
|
8
|
-
attributes = attributes.dup # prevent delete from having side effects
|
9
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
-
if providers.include?(provider)
|
11
|
-
begin
|
12
|
-
require "fog/#{provider}/cdn"
|
13
|
-
begin
|
14
|
-
Fog::CDN.const_get(Fog.providers[provider])
|
15
|
-
rescue
|
16
|
-
Fog.const_get(Fog.providers[provider])::CDN
|
17
|
-
end.new(attributes)
|
18
|
-
rescue
|
19
|
-
raise ArgumentError, "#{provider} has no cdn service"
|
20
|
-
end
|
21
|
-
else
|
22
|
-
raise ArgumentError, "#{provider} is not a recognized provider"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.providers
|
27
|
-
Fog.services[:cdn]
|
28
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
29
4
|
end
|
30
5
|
end
|
data/lib/fog/compute.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module Fog
|
2
2
|
module Compute
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup # prevent delete from having side effects
|
9
7
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
|
11
9
|
case provider
|
@@ -61,27 +59,10 @@ module Fog
|
|
61
59
|
require "fog/vcloud_director/compute"
|
62
60
|
Fog::Compute::VcloudDirector.new(attributes)
|
63
61
|
else
|
64
|
-
|
65
|
-
begin
|
66
|
-
require "fog/#{provider}/compute"
|
67
|
-
rescue LoadError
|
68
|
-
require "fog/compute/#{provider}"
|
69
|
-
end
|
70
|
-
begin
|
71
|
-
Fog::Compute.const_get(Fog.providers[provider])
|
72
|
-
rescue
|
73
|
-
Fog.const_get(Fog.providers[provider])::Compute
|
74
|
-
end.new(attributes)
|
75
|
-
else
|
76
|
-
raise ArgumentError, "#{provider} is not a recognized compute provider"
|
77
|
-
end
|
62
|
+
super(orig_attributes)
|
78
63
|
end
|
79
64
|
end
|
80
65
|
|
81
|
-
def self.providers
|
82
|
-
Fog.services[:compute]
|
83
|
-
end
|
84
|
-
|
85
66
|
def self.servers
|
86
67
|
servers = []
|
87
68
|
providers.each do |provider|
|
data/lib/fog/core.rb
CHANGED
@@ -13,6 +13,9 @@ require "ipaddr"
|
|
13
13
|
# internal core dependencies
|
14
14
|
require File.expand_path('../core/version', __FILE__)
|
15
15
|
|
16
|
+
# Mixins
|
17
|
+
require File.expand_path('../core/services_mixin', __FILE__)
|
18
|
+
|
16
19
|
require File.expand_path('../core/attributes', __FILE__)
|
17
20
|
require File.expand_path('../core/attributes/default', __FILE__)
|
18
21
|
require File.expand_path('../core/attributes/array', __FILE__)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module ServicesMixin
|
3
|
+
def [](provider)
|
4
|
+
new(:provider => provider)
|
5
|
+
end
|
6
|
+
|
7
|
+
def new(attributes)
|
8
|
+
attributes = attributes.dup # Prevent delete from having side effects
|
9
|
+
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
+
provider_name = Fog.providers[provider]
|
11
|
+
|
12
|
+
raise ArgumentError, "#{provider} is not a recognized provider" unless providers.include?(provider)
|
13
|
+
|
14
|
+
require_service_provider_library(service_name.downcase, provider)
|
15
|
+
spc = service_provider_constant(service_name, provider_name)
|
16
|
+
spc.new(attributes)
|
17
|
+
rescue LoadError, NameError # Only rescue errors in finding the libraries, allow connection errors through to the caller
|
18
|
+
raise ArgumentError, "#{provider} has no #{service_name.downcase} service"
|
19
|
+
end
|
20
|
+
|
21
|
+
def providers
|
22
|
+
Fog.services[service_name.downcase.to_sym] || []
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def require_service_provider_library(service, provider)
|
28
|
+
require "fog/#{provider}/#{service}"
|
29
|
+
rescue LoadError # Try to require the service provider in an alternate location
|
30
|
+
require "fog/#{service}/#{provider}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def service_provider_constant(service_name, provider_name)
|
34
|
+
Fog.const_get(service_name).const_get(provider_name)
|
35
|
+
rescue NameError # Try to find the constant from in an alternate location
|
36
|
+
Fog.const_get(provider_name).const_get(service_name)
|
37
|
+
end
|
38
|
+
|
39
|
+
def service_name
|
40
|
+
name.split("Fog::").last
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/fog/core/version.rb
CHANGED
data/lib/fog/dns.rb
CHANGED
@@ -1,33 +1,18 @@
|
|
1
1
|
module Fog
|
2
2
|
module DNS
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup # prevent delete from having side effects
|
9
7
|
case provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
when :stormondemand
|
11
9
|
require "fog/dns/storm_on_demand"
|
12
10
|
Fog::DNS::StormOnDemand.new(attributes)
|
13
11
|
else
|
14
|
-
|
15
|
-
require "fog/#{provider}/dns"
|
16
|
-
begin
|
17
|
-
Fog::DNS.const_get(Fog.providers[provider])
|
18
|
-
rescue
|
19
|
-
Fog.const_get(Fog.providers[provider])::DNS
|
20
|
-
end.new(attributes)
|
21
|
-
else
|
22
|
-
raise ArgumentError, "#{provider} is not a recognized dns provider"
|
23
|
-
end
|
12
|
+
super(orig_attributes)
|
24
13
|
end
|
25
14
|
end
|
26
15
|
|
27
|
-
def self.providers
|
28
|
-
Fog.services[:dns]
|
29
|
-
end
|
30
|
-
|
31
16
|
def self.zones
|
32
17
|
zones = []
|
33
18
|
providers.each do |provider|
|
data/lib/fog/identity.rb
CHANGED
@@ -1,27 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Identity
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.new(attributes)
|
8
|
-
attributes = attributes.dup # Prevent delete from having side effects
|
9
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
-
|
11
|
-
unless providers.include?(provider)
|
12
|
-
raise ArgumentError, "#{provider} has no identity service"
|
13
|
-
end
|
14
|
-
|
15
|
-
require "fog/#{provider}/identity"
|
16
|
-
begin
|
17
|
-
Fog::Identity.const_get(Fog.providers[provider])
|
18
|
-
rescue
|
19
|
-
Fog.const_get(Fog.providers[provider])::Identity
|
20
|
-
end.new(attributes)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.providers
|
24
|
-
Fog.services[:identity]
|
25
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
26
4
|
end
|
27
5
|
end
|
data/lib/fog/image.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Image
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.new(attributes)
|
8
|
-
attributes = attributes.dup # Prevent delete from having side effects
|
9
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
-
if providers.include?(provider)
|
11
|
-
begin
|
12
|
-
require "fog/#{provider}/image"
|
13
|
-
begin
|
14
|
-
Fog::Image.const_get(Fog.providers[provider])
|
15
|
-
rescue
|
16
|
-
Fog.const_get(Fog.providers[provider])::Image
|
17
|
-
end.new(attributes)
|
18
|
-
rescue
|
19
|
-
raise ArgumentError, "#{provider} has no image service"
|
20
|
-
end
|
21
|
-
else
|
22
|
-
raise ArgumentError, "#{provider} is not a recognized provider"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.providers
|
27
|
-
Fog.services[:image]
|
28
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
29
4
|
end
|
30
5
|
end
|
data/lib/fog/metering.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Metering
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.new(attributes)
|
8
|
-
attributes = attributes.dup # Prevent delete from having side effects
|
9
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
-
if providers.include?(provider)
|
11
|
-
begin
|
12
|
-
require "fog/#{provider}/metering"
|
13
|
-
begin
|
14
|
-
Fog::Metering.const_get(Fog.providers[provider])
|
15
|
-
rescue
|
16
|
-
Fog.const_get(Fog.providers[provider])::Metering
|
17
|
-
end.new(attributes)
|
18
|
-
rescue
|
19
|
-
raise ArgumentError, "#{provider} has no metering service"
|
20
|
-
end
|
21
|
-
else
|
22
|
-
raise ArgumentError, "#{provider} is not a recognized provider"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.providers
|
27
|
-
Fog.services[:metering]
|
28
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
29
4
|
end
|
30
5
|
end
|
data/lib/fog/monitoring.rb
CHANGED
@@ -1,33 +1,16 @@
|
|
1
1
|
module Fog
|
2
2
|
module Monitoring
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup
|
9
7
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
if provider == :stormondemand
|
11
9
|
require "fog/monitoring/storm_on_demand"
|
12
10
|
Fog::Monitoring::StormOnDemand.new(attributes)
|
13
|
-
elsif providers.include?(provider)
|
14
|
-
begin
|
15
|
-
require "fog/#{provider}/monitoring"
|
16
|
-
begin
|
17
|
-
Fog::Monitoring.const_get(Fog.providers[provider])
|
18
|
-
rescue
|
19
|
-
Fog.const_get(Fog.providers[provider])::Monitoring
|
20
|
-
end.new(attributes)
|
21
|
-
rescue
|
22
|
-
raise ArgumentError, "#{provider} has no monitoring service"
|
23
|
-
end
|
24
11
|
else
|
25
|
-
|
12
|
+
super(orig_attributes)
|
26
13
|
end
|
27
14
|
end
|
28
|
-
|
29
|
-
def self.providers
|
30
|
-
Fog.services[:monitoring]
|
31
|
-
end
|
32
15
|
end
|
33
16
|
end
|
data/lib/fog/network.rb
CHANGED
@@ -1,34 +1,17 @@
|
|
1
1
|
module Fog
|
2
2
|
module Network
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup # Prevent delete from having side effects
|
9
7
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
|
11
9
|
if provider == :stormondemand
|
12
10
|
require "fog/network/storm_on_demand"
|
13
11
|
return Fog::Network::StormOnDemand.new(attributes)
|
14
|
-
elsif providers.include?(provider)
|
15
|
-
begin
|
16
|
-
require "fog/#{provider}/network"
|
17
|
-
begin
|
18
|
-
Fog::Network.const_get(Fog.providers[provider])
|
19
|
-
rescue
|
20
|
-
Fog.const_get(Fog.providers[provider])::Network
|
21
|
-
end.new(attributes)
|
22
|
-
rescue
|
23
|
-
raise ArgumentError, "#{provider} has no network service"
|
24
|
-
end
|
25
12
|
else
|
26
|
-
|
13
|
+
super(orig_attributes)
|
27
14
|
end
|
28
15
|
end
|
29
|
-
|
30
|
-
def self.providers
|
31
|
-
Fog.services[:network]
|
32
|
-
end
|
33
16
|
end
|
34
17
|
end
|
data/lib/fog/orchestration.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Orchestration
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.new(attributes)
|
8
|
-
attributes = attributes.dup # Prevent delete from having side effects
|
9
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
-
if providers.include?(provider)
|
11
|
-
begin
|
12
|
-
require "fog/#{provider}/orchestration"
|
13
|
-
begin
|
14
|
-
Fog::Orchestration.const_get(Fog.providers[provider])
|
15
|
-
rescue
|
16
|
-
Fog.const_get(Fog.providers[provider])::Orchestration
|
17
|
-
end.new(attributes)
|
18
|
-
rescue
|
19
|
-
raise ArgumentError, "#{provider} has no orchestration service"
|
20
|
-
end
|
21
|
-
else
|
22
|
-
raise ArgumentError, "#{provider} is not a recognized provider"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.providers
|
27
|
-
Fog.services[:orchestration]
|
28
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
29
4
|
end
|
30
5
|
end
|
data/lib/fog/storage.rb
CHANGED
@@ -7,12 +7,10 @@ end
|
|
7
7
|
|
8
8
|
module Fog
|
9
9
|
module Storage
|
10
|
-
|
11
|
-
new(:provider => provider)
|
12
|
-
end
|
10
|
+
extend Fog::ServicesMixin
|
13
11
|
|
14
|
-
def self.new(
|
15
|
-
attributes =
|
12
|
+
def self.new(orig_attributes)
|
13
|
+
attributes = orig_attributes.dup # prevent delete from having side effects
|
16
14
|
case provider = attributes.delete(:provider).to_s.downcase.to_sym
|
17
15
|
when :internetarchive
|
18
16
|
require "fog/internet_archive/storage"
|
@@ -21,16 +19,7 @@ module Fog
|
|
21
19
|
require "fog/storage/storm_on_demand"
|
22
20
|
Fog::Storage::StormOnDemand.new(attributes)
|
23
21
|
else
|
24
|
-
|
25
|
-
require "fog/#{provider}/storage"
|
26
|
-
begin
|
27
|
-
Fog::Storage.const_get(Fog.providers[provider])
|
28
|
-
rescue
|
29
|
-
Fog.const_get(Fog.providers[provider])::Storage
|
30
|
-
end.new(attributes)
|
31
|
-
else
|
32
|
-
raise ArgumentError, "#{provider} is not a recognized storage provider"
|
33
|
-
end
|
22
|
+
super(orig_attributes)
|
34
23
|
end
|
35
24
|
end
|
36
25
|
|
@@ -87,9 +76,5 @@ module Fog
|
|
87
76
|
}
|
88
77
|
}
|
89
78
|
end
|
90
|
-
|
91
|
-
def self.providers
|
92
|
-
Fog.services[:storage]
|
93
|
-
end
|
94
79
|
end
|
95
80
|
end
|
data/lib/fog/support.rb
CHANGED
@@ -1,34 +1,17 @@
|
|
1
1
|
module Fog
|
2
2
|
module Support
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup
|
9
7
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
|
11
9
|
if provider == :stormondemand
|
12
10
|
require "fog/support/storm_on_demand"
|
13
11
|
Fog::Support::StormOnDemand.new(attributes)
|
14
|
-
elsif providers.include?(provider)
|
15
|
-
begin
|
16
|
-
require "fog/#{provider}/support"
|
17
|
-
begin
|
18
|
-
Fog::Support.const_get(Fog.providers[provider])
|
19
|
-
rescue
|
20
|
-
Fog.const_get(Fog.providers[provider])::Support
|
21
|
-
end.new(attributes)
|
22
|
-
rescue
|
23
|
-
raise ArgumentError, "#{provider} has no support service"
|
24
|
-
end
|
25
12
|
else
|
26
|
-
|
13
|
+
super(orig_attributes)
|
27
14
|
end
|
28
15
|
end
|
29
|
-
|
30
|
-
def self.providers
|
31
|
-
Fog.services[:support]
|
32
|
-
end
|
33
16
|
end
|
34
17
|
end
|
data/lib/fog/volume.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Volume
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.new(attributes)
|
8
|
-
attributes = attributes.dup # Prevent delete from having side effects
|
9
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
|
-
if providers.include?(provider)
|
11
|
-
begin
|
12
|
-
require "fog/#{provider}/volume"
|
13
|
-
begin
|
14
|
-
Fog::Volume.const_get(Fog.providers[provider])
|
15
|
-
rescue
|
16
|
-
Fog.const_get(Fog.providers[provider])::Volume
|
17
|
-
end.new(attributes)
|
18
|
-
rescue
|
19
|
-
raise ArgumentError, "#{provider} has no volume service"
|
20
|
-
end
|
21
|
-
else
|
22
|
-
raise ArgumentError, "#{provider} is not a recognized provider"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.providers
|
27
|
-
Fog.services[:volume]
|
28
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
29
4
|
end
|
30
5
|
end
|
data/lib/fog/vpn.rb
CHANGED
@@ -1,34 +1,17 @@
|
|
1
1
|
module Fog
|
2
2
|
module VPN
|
3
|
-
|
4
|
-
new(:provider => provider)
|
5
|
-
end
|
3
|
+
extend Fog::ServicesMixin
|
6
4
|
|
7
|
-
def self.new(
|
8
|
-
attributes =
|
5
|
+
def self.new(orig_attributes)
|
6
|
+
attributes = orig_attributes.dup
|
9
7
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
10
8
|
|
11
9
|
if provider == :stormondemand
|
12
10
|
require "fog/vpn/storm_on_demand"
|
13
11
|
Fog::VPN::StormOnDemand.new(attributes)
|
14
|
-
elsif providers.include?(provider)
|
15
|
-
begin
|
16
|
-
require "fog/#{provider}/vpn"
|
17
|
-
begin
|
18
|
-
Fog::VPN.const_get(Fog.providers[provider])
|
19
|
-
rescue
|
20
|
-
Fog.const_get(Fog.providers[provider])::VPN
|
21
|
-
end.new(attributes)
|
22
|
-
rescue
|
23
|
-
raise ArgumentError, "#{provider} has no vpn service"
|
24
|
-
end
|
25
12
|
else
|
26
|
-
|
13
|
+
super(orig_attributes)
|
27
14
|
end
|
28
15
|
end
|
29
|
-
|
30
|
-
def self.providers
|
31
|
-
Fog.services[:vpn]
|
32
|
-
end
|
33
16
|
end
|
34
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Light
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -263,6 +263,7 @@ files:
|
|
263
263
|
- lib/fog/core/provider.rb
|
264
264
|
- lib/fog/core/scp.rb
|
265
265
|
- lib/fog/core/service.rb
|
266
|
+
- lib/fog/core/services_mixin.rb
|
266
267
|
- lib/fog/core/ssh.rb
|
267
268
|
- lib/fog/core/stringify_keys.rb
|
268
269
|
- lib/fog/core/time.rb
|