fog-core 1.24.0 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.rubocop.yml +20 -0
- data/changelog.md +17 -0
- data/fog-core.gemspec +2 -1
- data/lib/fog/account.rb +3 -5
- data/lib/fog/billing.rb +3 -4
- data/lib/fog/cdn.rb +3 -5
- data/lib/fog/compute.rb +17 -20
- data/lib/fog/compute/models/server.rb +21 -26
- data/lib/fog/core.rb +61 -60
- data/lib/fog/core/association.rb +15 -0
- data/lib/fog/core/associations/default.rb +21 -3
- data/lib/fog/core/associations/many_identities.rb +8 -2
- data/lib/fog/core/associations/many_models.rb +7 -2
- data/lib/fog/core/associations/one_identity.rb +6 -1
- data/lib/fog/core/associations/one_model.rb +5 -1
- data/lib/fog/core/attributes.rb +41 -44
- data/lib/fog/core/attributes/array.rb +5 -1
- data/lib/fog/core/attributes/boolean.rb +5 -1
- data/lib/fog/core/attributes/default.rb +12 -2
- data/lib/fog/core/attributes/float.rb +5 -1
- data/lib/fog/core/attributes/integer.rb +5 -1
- data/lib/fog/core/attributes/string.rb +5 -1
- data/lib/fog/core/attributes/time.rb +5 -1
- data/lib/fog/core/attributes/timestamp.rb +5 -1
- data/lib/fog/core/collection.rb +22 -27
- data/lib/fog/core/connection.rb +5 -6
- data/lib/fog/core/credentials.rb +7 -7
- data/lib/fog/core/current_machine.rb +10 -8
- data/lib/fog/core/deprecated_connection_accessors.rb +0 -1
- data/lib/fog/core/deprecation.rb +0 -2
- data/lib/fog/core/errors.rb +3 -5
- data/lib/fog/core/hmac.rb +4 -6
- data/lib/fog/core/logger.rb +10 -11
- data/lib/fog/core/mock.rb +19 -25
- data/lib/fog/core/model.rb +9 -20
- data/lib/fog/core/provider.rb +6 -9
- data/lib/fog/core/scp.rb +14 -24
- data/lib/fog/core/service.rb +28 -31
- data/lib/fog/core/ssh.rb +16 -24
- data/lib/fog/core/stringify_keys.rb +7 -9
- data/lib/fog/core/time.rb +5 -7
- data/lib/fog/core/utils.rb +24 -20
- data/lib/fog/core/uuid.rb +2 -3
- data/lib/fog/core/version.rb +3 -1
- data/lib/fog/core/wait_for.rb +2 -2
- data/lib/fog/core/wait_for_defaults.rb +13 -10
- data/lib/fog/core/whitelist_keys.rb +1 -1
- data/lib/fog/dns.rb +6 -8
- data/lib/fog/identity.rb +5 -6
- data/lib/fog/image.rb +3 -5
- data/lib/fog/metering.rb +3 -6
- data/lib/fog/monitoring.rb +3 -5
- data/lib/fog/network.rb +4 -6
- data/lib/fog/orchestration.rb +3 -5
- data/lib/fog/schema/data_validator.rb +17 -22
- data/lib/fog/storage.rb +22 -16
- data/lib/fog/support.rb +3 -6
- data/lib/fog/test_helpers.rb +10 -10
- data/lib/fog/test_helpers/collection_helper.rb +23 -43
- data/lib/fog/test_helpers/compute/flavors_helper.rb +4 -10
- data/lib/fog/test_helpers/compute/server_helper.rb +3 -9
- data/lib/fog/test_helpers/compute/servers_helper.rb +0 -4
- data/lib/fog/test_helpers/formats_helper.rb +13 -14
- data/lib/fog/test_helpers/helper.rb +9 -4
- data/lib/fog/test_helpers/mock_helper.rb +92 -94
- data/lib/fog/test_helpers/model_helper.rb +7 -15
- data/lib/fog/test_helpers/responds_to_helper.rb +1 -3
- data/lib/fog/test_helpers/succeeds_helper.rb +1 -3
- data/lib/fog/volume.rb +3 -6
- data/lib/fog/vpn.rb +3 -5
- data/lib/tasks/test_task.rb +2 -6
- data/spec/compute_spec.rb +11 -13
- data/spec/connection_spec.rb +24 -14
- data/spec/credentials_spec.rb +23 -23
- data/spec/current_machine_spec.rb +6 -6
- data/spec/fake_app/fake_service.rb +18 -0
- data/spec/fake_app/models/collection.rb +5 -0
- data/spec/fake_app/models/model.rb +2 -0
- data/spec/fake_app/requests/request.rb +11 -0
- data/spec/fog_attribute_spec.rb +178 -136
- data/spec/identity_spec.rb +11 -13
- data/spec/mocking_spec.rb +7 -8
- data/spec/service_spec.rb +21 -7
- data/spec/spec_helper.rb +14 -8
- data/spec/storage_spec.rb +25 -13
- data/spec/test_helpers/formats_helper_spec.rb +52 -52
- data/spec/test_helpers/schema_validator_spec.rb +45 -45
- data/spec/timeout_spec.rb +1 -2
- data/spec/utils_spec.rb +2 -2
- data/spec/uuid_spec.rb +1 -1
- data/spec/wait_for_spec.rb +7 -4
- metadata +57 -33
data/lib/fog/storage.rb
CHANGED
@@ -1,38 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require "mime/types"
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Storage
|
5
|
-
|
6
5
|
def self.[](provider)
|
7
|
-
|
6
|
+
new(:provider => provider)
|
8
7
|
end
|
9
8
|
|
10
9
|
def self.new(attributes)
|
11
10
|
attributes = attributes.dup # prevent delete from having side effects
|
12
11
|
case provider = attributes.delete(:provider).to_s.downcase.to_sym
|
13
12
|
when :internetarchive
|
14
|
-
require
|
13
|
+
require "fog/internet_archive/storage"
|
15
14
|
Fog::Storage::InternetArchive.new(attributes)
|
16
15
|
when :stormondemand
|
17
|
-
require
|
16
|
+
require "fog/storm_on_demand/storage"
|
18
17
|
Fog::Storage::StormOnDemand.new(attributes)
|
19
18
|
else
|
20
|
-
if
|
19
|
+
if providers.include?(provider)
|
21
20
|
require "fog/#{provider}/storage"
|
22
21
|
begin
|
23
22
|
Fog::Storage.const_get(Fog.providers[provider])
|
24
23
|
rescue
|
25
|
-
Fog
|
24
|
+
Fog.const_get(Fog.providers[provider])::Storage
|
26
25
|
end.new(attributes)
|
27
26
|
else
|
28
|
-
raise ArgumentError
|
27
|
+
raise ArgumentError, "#{provider} is not a recognized storage provider"
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
32
|
def self.directories
|
34
33
|
directories = []
|
35
|
-
|
34
|
+
providers.each do |provider|
|
36
35
|
begin
|
37
36
|
directories.concat(self[provider].directories)
|
38
37
|
rescue # ignore any missing credentials/etc
|
@@ -42,10 +41,12 @@ module Fog
|
|
42
41
|
end
|
43
42
|
|
44
43
|
def self.get_body_size(body)
|
45
|
-
if body.respond_to?(:
|
44
|
+
if body.respond_to?(:encoding)
|
45
|
+
original_encoding = body.encoding
|
46
46
|
body.force_encoding('BINARY')
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
|
+
size = if body.respond_to?(:bytesize)
|
49
50
|
body.bytesize
|
50
51
|
elsif body.respond_to?(:size)
|
51
52
|
body.size
|
@@ -54,10 +55,16 @@ module Fog
|
|
54
55
|
else
|
55
56
|
0
|
56
57
|
end
|
58
|
+
|
59
|
+
if body.respond_to?(:encoding)
|
60
|
+
body.force_encoding(original_encoding)
|
61
|
+
end
|
62
|
+
|
63
|
+
size
|
57
64
|
end
|
58
65
|
|
59
66
|
def self.get_content_type(data)
|
60
|
-
if data.respond_to?(:path)
|
67
|
+
if data.respond_to?(:path) && !data.path.nil?
|
61
68
|
filename = ::File.basename(data.path)
|
62
69
|
unless (mime_types = MIME::Types.of(filename)).empty?
|
63
70
|
mime_types.first.content_type
|
@@ -69,9 +76,9 @@ module Fog
|
|
69
76
|
{
|
70
77
|
:body => data,
|
71
78
|
:headers => {
|
72
|
-
|
73
|
-
|
74
|
-
#
|
79
|
+
"Content-Length" => get_body_size(data),
|
80
|
+
"Content-Type" => get_content_type(data)
|
81
|
+
# "Content-MD5" => Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
|
75
82
|
}
|
76
83
|
}
|
77
84
|
end
|
@@ -79,6 +86,5 @@ module Fog
|
|
79
86
|
def self.providers
|
80
87
|
Fog.services[:storage]
|
81
88
|
end
|
82
|
-
|
83
89
|
end
|
84
90
|
end
|
data/lib/fog/support.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Support
|
3
|
-
|
4
3
|
def self.[](provider)
|
5
|
-
|
4
|
+
new(:provider => provider)
|
6
5
|
end
|
7
6
|
|
8
7
|
def self.new(attributes)
|
@@ -10,17 +9,15 @@ module Fog
|
|
10
9
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
11
10
|
|
12
11
|
if provider == :stormondemand
|
13
|
-
require
|
12
|
+
require "fog/storm_on_demand/support"
|
14
13
|
Fog::Support::StormOnDemand.new(attributes)
|
15
14
|
else
|
16
|
-
raise ArgumentError
|
15
|
+
raise ArgumentError, "#{provider} has no support service"
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
18
|
|
21
19
|
def self.providers
|
22
20
|
Fog.services[:support]
|
23
21
|
end
|
24
|
-
|
25
22
|
end
|
26
23
|
end
|
data/lib/fog/test_helpers.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# So downstream users can use the test_helpers
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
3
|
+
require "fog/test_helpers/helper"
|
4
|
+
require "fog/test_helpers/collection_helper"
|
5
|
+
require "fog/test_helpers/formats_helper"
|
6
|
+
require "fog/test_helpers/mock_helper"
|
7
|
+
require "fog/test_helpers/model_helper"
|
8
|
+
require "fog/test_helpers/responds_to_helper"
|
9
|
+
require "fog/test_helpers/succeeds_helper"
|
10
|
+
require "fog/test_helpers/compute/flavors_helper"
|
11
|
+
require "fog/test_helpers/compute/server_helper"
|
12
|
+
require "fog/test_helpers/compute/servers_helper"
|
@@ -1,7 +1,5 @@
|
|
1
1
|
def collection_tests(collection, params = {}, mocks_implemented = true)
|
2
|
-
|
3
|
-
tests('success') do
|
4
|
-
|
2
|
+
tests("success") do
|
5
3
|
tests("#new(#{params.inspect})").succeeds do
|
6
4
|
pending if Fog.mocking? && !mocks_implemented
|
7
5
|
collection.new(params)
|
@@ -22,69 +20,53 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
|
|
22
20
|
collection.all
|
23
21
|
end
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
if !Fog.mocking? || mocks_implemented
|
28
|
-
@identity = @instance.identity
|
29
|
-
end
|
23
|
+
@identity = @instance.identity if !Fog.mocking? || mocks_implemented
|
30
24
|
|
31
25
|
tests("#get(#{@identity})").succeeds do
|
32
26
|
pending if Fog.mocking? && !mocks_implemented
|
33
27
|
collection.get(@identity)
|
34
28
|
end
|
35
29
|
|
36
|
-
tests(
|
30
|
+
tests("Enumerable") do
|
37
31
|
pending if Fog.mocking? && !mocks_implemented
|
38
32
|
|
39
|
-
methods =
|
40
|
-
|
41
|
-
'find_index', 'flat_map', 'collect_concat', 'group_by',
|
42
|
-
'none?', 'one?'
|
43
|
-
]
|
33
|
+
methods = %w(all any? find detect collect map find_index flat_map
|
34
|
+
collect_concat group_by none? one?)
|
44
35
|
|
45
36
|
# JRuby 1.7.5+ issue causes a SystemStackError: stack level too deep
|
46
37
|
# https://github.com/jruby/jruby/issues/1265
|
47
|
-
if RUBY_PLATFORM == "java"
|
48
|
-
methods.delete(
|
38
|
+
if RUBY_PLATFORM == "java" && JRUBY_VERSION =~ /1\.7\.[5-8]/
|
39
|
+
methods.delete("all?")
|
49
40
|
end
|
50
41
|
|
51
42
|
methods.each do |enum_method|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
43
|
+
next unless collection.respond_to?(enum_method)
|
44
|
+
tests("##{enum_method}").succeeds do
|
45
|
+
block_called = false
|
46
|
+
collection.send(enum_method) { block_called = true }
|
47
|
+
block_called
|
58
48
|
end
|
59
49
|
end
|
60
50
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
block_called =
|
67
|
-
|
68
|
-
block_called
|
51
|
+
%w(max_by min_by).each do |enum_method|
|
52
|
+
next unless collection.respond_to?(enum_method)
|
53
|
+
tests("##{enum_method}").succeeds do
|
54
|
+
block_called = false
|
55
|
+
collection.send(enum_method) do
|
56
|
+
block_called = true
|
57
|
+
0
|
69
58
|
end
|
59
|
+
block_called
|
70
60
|
end
|
71
|
-
|
72
61
|
end
|
73
|
-
|
74
62
|
end
|
75
63
|
|
64
|
+
yield if block_given?
|
76
65
|
|
77
|
-
if
|
78
|
-
yield
|
79
|
-
end
|
80
|
-
|
81
|
-
if !Fog.mocking? || mocks_implemented
|
82
|
-
@instance.destroy
|
83
|
-
end
|
66
|
+
@instance.destroy if !Fog.mocking? || mocks_implemented
|
84
67
|
end
|
85
68
|
|
86
|
-
tests(
|
87
|
-
|
69
|
+
tests("failure") do
|
88
70
|
if !Fog.mocking? || mocks_implemented
|
89
71
|
@identity = @identity.to_s
|
90
72
|
@identity = @identity.gsub(/[a-zA-Z]/) { Fog::Mock.random_letters(1) }
|
@@ -96,7 +78,5 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
|
|
96
78
|
pending if Fog.mocking? && !mocks_implemented
|
97
79
|
collection.get(@identity)
|
98
80
|
end
|
99
|
-
|
100
81
|
end
|
101
|
-
|
102
82
|
end
|
@@ -1,7 +1,5 @@
|
|
1
|
-
def flavors_tests(connection,
|
2
|
-
|
3
|
-
tests('success') do
|
4
|
-
|
1
|
+
def flavors_tests(connection, _params = {}, mocks_implemented = true)
|
2
|
+
tests("success") do
|
5
3
|
tests("#all").succeeds do
|
6
4
|
pending if Fog.mocking? && !mocks_implemented
|
7
5
|
connection.flavors.all
|
@@ -15,20 +13,16 @@ def flavors_tests(connection, params = {}, mocks_implemented = true)
|
|
15
13
|
pending if Fog.mocking? && !mocks_implemented
|
16
14
|
connection.flavors.get(@identity)
|
17
15
|
end
|
18
|
-
|
19
16
|
end
|
20
17
|
|
21
|
-
tests(
|
22
|
-
|
18
|
+
tests("failure") do
|
23
19
|
if !Fog.mocking? || mocks_implemented
|
24
|
-
invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/,
|
20
|
+
invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/, "0")
|
25
21
|
end
|
26
22
|
|
27
23
|
tests("#get('#{invalid_flavor_identity}')").returns(nil) do
|
28
24
|
pending if Fog.mocking? && !mocks_implemented
|
29
25
|
connection.flavors.get(invalid_flavor_identity)
|
30
26
|
end
|
31
|
-
|
32
27
|
end
|
33
|
-
|
34
28
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
def server_tests(connection, params = {}, mocks_implemented = true)
|
2
|
-
|
3
2
|
model_tests(connection.servers, params, mocks_implemented) do
|
4
|
-
|
5
|
-
tests('#reload').returns(true) do
|
3
|
+
tests("#reload").returns(true) do
|
6
4
|
pending if Fog.mocking? && !mocks_implemented
|
7
5
|
@instance.wait_for { ready? }
|
8
6
|
identity = @instance.identity
|
@@ -12,16 +10,12 @@ def server_tests(connection, params = {}, mocks_implemented = true)
|
|
12
10
|
responds_to([:ready?, :state])
|
13
11
|
yield if block_given?
|
14
12
|
|
15
|
-
tests(
|
13
|
+
tests("#reboot").succeeds do
|
16
14
|
pending if Fog.mocking? && !mocks_implemented
|
17
15
|
@instance.wait_for { ready? }
|
18
16
|
@instance.reboot
|
19
17
|
end
|
20
18
|
|
21
|
-
if !Fog.mocking? || mocks_implemented
|
22
|
-
@instance.wait_for { ready? }
|
23
|
-
end
|
24
|
-
|
19
|
+
@instance.wait_for { ready? } if !Fog.mocking? || mocks_implemented
|
25
20
|
end
|
26
|
-
|
27
21
|
end
|
@@ -1,12 +1,8 @@
|
|
1
1
|
def servers_tests(connection, params = {}, mocks_implemented = true)
|
2
|
-
|
3
2
|
collection_tests(connection.servers, params, mocks_implemented) do
|
4
|
-
|
5
3
|
if !Fog.mocking? || mocks_implemented
|
6
4
|
@instance.wait_for { ready? }
|
7
5
|
yield if block_given?
|
8
6
|
end
|
9
|
-
|
10
7
|
end
|
11
|
-
|
12
8
|
end
|
@@ -2,7 +2,7 @@ require "fog/schema/data_validator"
|
|
2
2
|
|
3
3
|
# format related hackery
|
4
4
|
# allows both true.is_a?(Fog::Boolean) and false.is_a?(Fog::Boolean)
|
5
|
-
# allows both nil.is_a?(Fog::Nullable::String) and
|
5
|
+
# allows both nil.is_a?(Fog::Nullable::String) and "".is_a?(Fog::Nullable::String)
|
6
6
|
module Fog
|
7
7
|
module Boolean; end
|
8
8
|
module Nullable
|
@@ -15,18 +15,17 @@ module Fog
|
|
15
15
|
module Array; end
|
16
16
|
end
|
17
17
|
end
|
18
|
-
[FalseClass, TrueClass].each {|klass| klass.send(:include, Fog::Boolean)}
|
19
|
-
[FalseClass, TrueClass, NilClass, Fog::Boolean].each {|klass| klass.send(:include, Fog::Nullable::Boolean)}
|
20
|
-
[NilClass, String].each {|klass| klass.send(:include, Fog::Nullable::String)}
|
21
|
-
[NilClass, Time].each {|klass| klass.send(:include, Fog::Nullable::Time)}
|
22
|
-
[Integer, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Integer)}
|
23
|
-
[Float, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Float)}
|
24
|
-
[Hash, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Hash)}
|
25
|
-
[Array, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Array)}
|
18
|
+
[FalseClass, TrueClass].each { |klass| klass.send(:include, Fog::Boolean) }
|
19
|
+
[FalseClass, TrueClass, NilClass, Fog::Boolean].each { |klass| klass.send(:include, Fog::Nullable::Boolean) }
|
20
|
+
[NilClass, String].each { |klass| klass.send(:include, Fog::Nullable::String) }
|
21
|
+
[NilClass, Time].each { |klass| klass.send(:include, Fog::Nullable::Time) }
|
22
|
+
[Integer, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Integer) }
|
23
|
+
[Float, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Float) }
|
24
|
+
[Hash, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Hash) }
|
25
|
+
[Array, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Array) }
|
26
26
|
|
27
27
|
module Shindo
|
28
28
|
class Tests
|
29
|
-
|
30
29
|
# Generates a Shindo test that compares a hash schema to the result
|
31
30
|
# of the passed in block returning true if they match.
|
32
31
|
#
|
@@ -73,7 +72,7 @@ module Shindo
|
|
73
72
|
#
|
74
73
|
# @return [Boolean]
|
75
74
|
def data_matches_schema(schema, options = {})
|
76
|
-
test(
|
75
|
+
test("data matches schema") do
|
77
76
|
validator = Fog::Schema::DataValidator.new
|
78
77
|
valid = validator.validate(yield, schema, options)
|
79
78
|
@message = validator.message unless valid
|
@@ -83,11 +82,11 @@ module Shindo
|
|
83
82
|
|
84
83
|
# @deprecated #formats is deprecated. Use #data_matches_schema instead
|
85
84
|
def formats(format, strict = true)
|
86
|
-
test(
|
85
|
+
test("has proper format") do
|
87
86
|
if strict
|
88
|
-
options = {:allow_extra_keys => false, :allow_optional_rules => true}
|
87
|
+
options = { :allow_extra_keys => false, :allow_optional_rules => true }
|
89
88
|
else
|
90
|
-
options = {:allow_extra_keys => true, :allow_optional_rules => true}
|
89
|
+
options = { :allow_extra_keys => true, :allow_optional_rules => true }
|
91
90
|
end
|
92
91
|
validator = Fog::Schema::DataValidator.new
|
93
92
|
valid = validator.validate(yield, format, options)
|
@@ -1,12 +1,17 @@
|
|
1
|
-
require
|
1
|
+
require "excon"
|
2
2
|
|
3
|
-
ENV[
|
4
|
-
ENV[
|
3
|
+
ENV["FOG_RC"] = ENV["FOG_RC"] || File.expand_path("../.fog", __FILE__)
|
4
|
+
ENV["FOG_CREDENTIAL"] = ENV["FOG_CREDENTIAL"] || "default"
|
5
5
|
|
6
6
|
Excon.defaults.merge!(:debug_request => true, :debug_response => true)
|
7
7
|
|
8
8
|
LOREM = <<HERE
|
9
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
|
9
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
|
10
|
+
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
11
|
+
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
12
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
|
13
|
+
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
|
14
|
+
sunt in culpa qui officia deserunt mollit anim id est laborum.
|
10
15
|
HERE
|
11
16
|
|
12
17
|
require "tempfile"
|
@@ -1,107 +1,105 @@
|
|
1
|
-
require
|
1
|
+
require "fog/core"
|
2
2
|
|
3
3
|
# Use so you can run in mock mode from the command line
|
4
4
|
#
|
5
5
|
# FOG_MOCK=true fog
|
6
6
|
|
7
|
-
if ENV["FOG_MOCK"] == "true"
|
8
|
-
Fog.mock!
|
9
|
-
end
|
7
|
+
Fog.mock! if ENV["FOG_MOCK"] == "true"
|
10
8
|
|
11
9
|
# if in mocked mode, fill in some fake credentials for us
|
12
10
|
if Fog.mock?
|
13
11
|
Fog.credentials = {
|
14
|
-
:aws_access_key_id =>
|
15
|
-
:aws_secret_access_key =>
|
16
|
-
:ia_access_key_id =>
|
17
|
-
:ia_secret_access_key =>
|
18
|
-
:atmos_storage_token =>
|
19
|
-
:atmos_storage_secret =>
|
20
|
-
:atmos_storage_endpoint =>
|
21
|
-
:bluebox_api_key =>
|
22
|
-
:bluebox_customer_id =>
|
23
|
-
:brightbox_client_id =>
|
24
|
-
:brightbox_secret =>
|
25
|
-
:cloudstack_disk_offering_id =>
|
26
|
-
:cloudstack_host =>
|
27
|
-
:cloudstack_network_ids =>
|
28
|
-
:cloudstack_service_offering_id =>
|
29
|
-
:cloudstack_template_id =>
|
30
|
-
:cloudstack_zone_id =>
|
31
|
-
:clodo_api_key =>
|
32
|
-
:clodo_username =>
|
33
|
-
:digitalocean_api_key =>
|
34
|
-
:digitalocean_client_id =>
|
35
|
-
:dnsimple_email =>
|
36
|
-
:dnsimple_password =>
|
37
|
-
:dnsmadeeasy_api_key =>
|
38
|
-
:dnsmadeeasy_secret_key =>
|
39
|
-
:ecloud_username =>
|
40
|
-
:ecloud_password =>
|
41
|
-
:ecloud_versions_uri =>
|
42
|
-
:glesys_username =>
|
43
|
-
:glesys_api_key =>
|
44
|
-
:go_grid_api_key =>
|
45
|
-
:go_grid_shared_secret =>
|
46
|
-
:google_storage_access_key_id =>
|
47
|
-
:google_storage_secret_access_key =>
|
48
|
-
:google_project =>
|
49
|
-
:google_client_email =>
|
50
|
-
:google_key_location =>
|
51
|
-
:hp_access_key =>
|
52
|
-
:hp_secret_key =>
|
53
|
-
:hp_tenant_id =>
|
54
|
-
:hp_avl_zone =>
|
55
|
-
:os_account_meta_temp_url_key =>
|
56
|
-
:ibm_username =>
|
57
|
-
:ibm_password =>
|
12
|
+
:aws_access_key_id => "aws_access_key_id",
|
13
|
+
:aws_secret_access_key => "aws_secret_access_key",
|
14
|
+
:ia_access_key_id => "aws_access_key_id",
|
15
|
+
:ia_secret_access_key => "aws_secret_access_key",
|
16
|
+
:atmos_storage_token => "atmos_token",
|
17
|
+
:atmos_storage_secret => "atmos_secret",
|
18
|
+
:atmos_storage_endpoint => "http://atmos.is.cool:1000/test1.0",
|
19
|
+
:bluebox_api_key => "bluebox_api_key",
|
20
|
+
:bluebox_customer_id => "bluebox_customer_id",
|
21
|
+
:brightbox_client_id => "brightbox_client_id",
|
22
|
+
:brightbox_secret => "brightbox_secret",
|
23
|
+
:cloudstack_disk_offering_id => "",
|
24
|
+
:cloudstack_host => "http://cloudstack.example.org",
|
25
|
+
:cloudstack_network_ids => "",
|
26
|
+
:cloudstack_service_offering_id => "4437ac6c-9fe3-477a-57ec-60a5a45896a4",
|
27
|
+
:cloudstack_template_id => "8a31cf9c-f248-0588-256e-9dbf58785216",
|
28
|
+
:cloudstack_zone_id => "c554c592-e09c-9df5-7688-4a32754a4305",
|
29
|
+
:clodo_api_key => "clodo_api_key",
|
30
|
+
:clodo_username => "clodo_username",
|
31
|
+
:digitalocean_api_key => "digitalocean_api_key",
|
32
|
+
:digitalocean_client_id => "digitalocean_client_id",
|
33
|
+
:dnsimple_email => "dnsimple_email",
|
34
|
+
:dnsimple_password => "dnsimple_password",
|
35
|
+
:dnsmadeeasy_api_key => "dnsmadeeasy_api_key",
|
36
|
+
:dnsmadeeasy_secret_key => "dnsmadeeasy_secret_key",
|
37
|
+
:ecloud_username => "ecloud_username",
|
38
|
+
:ecloud_password => "ecloud_password",
|
39
|
+
:ecloud_versions_uri => "http://ecloud.versions.uri",
|
40
|
+
:glesys_username => "glesys_username",
|
41
|
+
:glesys_api_key => "glesys_api_key",
|
42
|
+
:go_grid_api_key => "go_grid_api_key",
|
43
|
+
:go_grid_shared_secret => "go_grid_shared_secret",
|
44
|
+
:google_storage_access_key_id => "google_storage_access_key_id",
|
45
|
+
:google_storage_secret_access_key => "google_storage_secret_access_key",
|
46
|
+
:google_project => "google_project_name",
|
47
|
+
:google_client_email => "fake@developer.gserviceaccount.com",
|
48
|
+
:google_key_location => "~/fake.p12",
|
49
|
+
:hp_access_key => "hp_access_key",
|
50
|
+
:hp_secret_key => "hp_secret_key",
|
51
|
+
:hp_tenant_id => "hp_tenant_id",
|
52
|
+
:hp_avl_zone => "hp_avl_zone",
|
53
|
+
:os_account_meta_temp_url_key => "os_account_meta_temp_url_key",
|
54
|
+
:ibm_username => "ibm_username",
|
55
|
+
:ibm_password => "ibm_password",
|
58
56
|
:joyent_username => "joyentuser",
|
59
57
|
:joyent_password => "joyentpass",
|
60
|
-
:linode_api_key =>
|
61
|
-
:local_root =>
|
62
|
-
:bare_metal_cloud_password =>
|
63
|
-
:bare_metal_cloud_username =>
|
64
|
-
:ninefold_compute_key =>
|
65
|
-
:ninefold_compute_secret =>
|
66
|
-
:ninefold_storage_secret =>
|
67
|
-
:ninefold_storage_token =>
|
68
|
-
#
|
69
|
-
#
|
70
|
-
:openstack_api_key =>
|
71
|
-
:openstack_username =>
|
72
|
-
:openstack_tenant =>
|
73
|
-
:openstack_auth_url =>
|
74
|
-
:ovirt_url =>
|
75
|
-
:ovirt_username =>
|
76
|
-
:ovirt_password =>
|
77
|
-
:libvirt_uri =>
|
78
|
-
:rackspace_api_key =>
|
79
|
-
:rackspace_username =>
|
80
|
-
:riakcs_access_key_id =>
|
81
|
-
:riakcs_secret_access_key =>
|
82
|
-
:storm_on_demand_username =>
|
83
|
-
:storm_on_demand_password =>
|
84
|
-
:vcloud_host =>
|
85
|
-
:vcloud_password =>
|
86
|
-
:vcloud_username =>
|
87
|
-
:vcloud_director_host =>
|
88
|
-
:vcloud_director_password =>
|
89
|
-
:vcloud_director_username =>
|
90
|
-
:voxel_api_key =>
|
91
|
-
:voxel_api_secret =>
|
92
|
-
:zerigo_email =>
|
93
|
-
:zerigo_token =>
|
94
|
-
:dynect_customer =>
|
95
|
-
:dynect_username =>
|
96
|
-
:dynect_password =>
|
97
|
-
:vsphere_server =>
|
98
|
-
:vsphere_username =>
|
99
|
-
:vsphere_password =>
|
100
|
-
:vsphere_expected_pubkey_hash =>
|
101
|
-
:libvirt_uri =>
|
102
|
-
:libvirt_username =>
|
103
|
-
:libvirt_password =>
|
104
|
-
:cloudsigma_username =>
|
105
|
-
:cloudsigma_password =>
|
58
|
+
:linode_api_key => "linode_api_key",
|
59
|
+
:local_root => "~/.fog",
|
60
|
+
:bare_metal_cloud_password => "bare_metal_cloud_password",
|
61
|
+
:bare_metal_cloud_username => "bare_metal_cloud_username",
|
62
|
+
:ninefold_compute_key => "ninefold_compute_key",
|
63
|
+
:ninefold_compute_secret => "ninefold_compute_secret",
|
64
|
+
:ninefold_storage_secret => "ninefold_storage_secret",
|
65
|
+
:ninefold_storage_token => "ninefold_storage_token",
|
66
|
+
# :public_key_path => "~/.ssh/id_rsa.pub",
|
67
|
+
# :private_key_path => "~/.ssh/id_rsa",
|
68
|
+
:openstack_api_key => "openstack_api_key",
|
69
|
+
:openstack_username => "openstack_username",
|
70
|
+
:openstack_tenant => "openstack_tenant",
|
71
|
+
:openstack_auth_url => "http://openstack:35357/v2.0/tokens",
|
72
|
+
:ovirt_url => "http://ovirt:8080/api",
|
73
|
+
:ovirt_username => "admin@internal",
|
74
|
+
:ovirt_password => "123123",
|
75
|
+
:libvirt_uri => "qemu://libvirt/system",
|
76
|
+
:rackspace_api_key => "rackspace_api_key",
|
77
|
+
:rackspace_username => "rackspace_username",
|
78
|
+
:riakcs_access_key_id => "riakcs_access_key_id",
|
79
|
+
:riakcs_secret_access_key => "riakcs_secret_access_key",
|
80
|
+
:storm_on_demand_username => "storm_on_demand_username",
|
81
|
+
:storm_on_demand_password => "storm_on_demand_password",
|
82
|
+
:vcloud_host => "vcloud_host",
|
83
|
+
:vcloud_password => "vcloud_password",
|
84
|
+
:vcloud_username => "vcloud_username",
|
85
|
+
:vcloud_director_host => "vcloud-director-host",
|
86
|
+
:vcloud_director_password => "vcloud_director_password",
|
87
|
+
:vcloud_director_username => "vcd_user@vcd_org_name",
|
88
|
+
:voxel_api_key => "voxel_api_key",
|
89
|
+
:voxel_api_secret => "voxel_api_secret",
|
90
|
+
:zerigo_email => "zerigo_email",
|
91
|
+
:zerigo_token => "zerigo_token",
|
92
|
+
:dynect_customer => "dynect_customer",
|
93
|
+
:dynect_username => "dynect_username",
|
94
|
+
:dynect_password => "dynect_password",
|
95
|
+
:vsphere_server => "virtualcenter.lan",
|
96
|
+
:vsphere_username => "apiuser",
|
97
|
+
:vsphere_password => "apipassword",
|
98
|
+
:vsphere_expected_pubkey_hash => "abcdef1234567890",
|
99
|
+
:libvirt_uri => "qemu:///system",
|
100
|
+
:libvirt_username => "root",
|
101
|
+
:libvirt_password => "password",
|
102
|
+
:cloudsigma_username => "csuname",
|
103
|
+
:cloudsigma_password => "cspass"
|
106
104
|
}.merge(Fog.credentials)
|
107
105
|
end
|