fog-core 2.1.0 → 2.6.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.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +2 -0
- data/.github/dependabot.yml +10 -0
- data/.github/workflows/ci.yml +32 -0
- data/.rubocop.yml +16 -12
- data/.rubocop_todo.yml +724 -0
- data/CONTRIBUTING.md +5 -1
- data/Gemfile +1 -1
- data/README.md +2 -1
- data/Rakefile +2 -14
- data/SECURITY.md +6 -0
- data/changelog.md +241 -141
- data/fog-core.gemspec +13 -9
- data/lib/fog/account.rb +0 -16
- data/lib/fog/billing.rb +0 -11
- data/lib/fog/compute/models/server.rb +7 -3
- data/lib/fog/compute.rb +3 -25
- data/lib/fog/core/association.rb +1 -0
- data/lib/fog/core/attributes/default.rb +7 -0
- data/lib/fog/core/attributes.rb +42 -5
- data/lib/fog/core/cache.rb +58 -55
- data/lib/fog/core/collection.rb +9 -3
- data/lib/fog/core/connection.rb +4 -6
- data/lib/fog/core/current_machine.rb +1 -1
- data/lib/fog/core/errors.rb +1 -1
- data/lib/fog/core/logger.rb +5 -2
- data/lib/fog/core/mock.rb +7 -2
- data/lib/fog/core/model.rb +34 -5
- data/lib/fog/core/provider.rb +37 -4
- data/lib/fog/core/scp.rb +16 -11
- data/lib/fog/core/service.rb +5 -5
- data/lib/fog/core/services_mixin.rb +62 -10
- data/lib/fog/core/ssh.rb +49 -25
- data/lib/fog/core/stringify_keys.rb +0 -2
- data/lib/fog/core/time.rb +2 -2
- data/lib/fog/core/uuid.rb +2 -8
- data/lib/fog/core/version.rb +3 -1
- data/lib/fog/core/wait_for.rb +2 -1
- data/lib/fog/core/wait_for_defaults.rb +2 -0
- data/lib/fog/core.rb +57 -59
- data/lib/fog/dns.rb +0 -11
- data/lib/fog/formatador.rb +9 -8
- data/lib/fog/monitoring.rb +0 -11
- data/lib/fog/network.rb +0 -12
- data/lib/fog/schema/data_validator.rb +1 -0
- data/lib/fog/storage.rb +15 -30
- data/lib/fog/support.rb +0 -12
- data/lib/fog/test_helpers/collection_helper.rb +2 -0
- data/lib/fog/test_helpers/formats_helper.rb +2 -2
- data/lib/fog/test_helpers/helper.rb +3 -3
- data/lib/fog/test_helpers/minitest/assertions.rb +1 -1
- data/lib/fog/test_helpers/minitest/expectations.rb +1 -1
- data/lib/fog/test_helpers/mock_helper.rb +84 -84
- data/lib/fog/test_helpers/succeeds_helper.rb +2 -2
- data/lib/fog/test_helpers/types_helper.rb +1 -0
- data/lib/fog/vpn.rb +0 -12
- data/lib/tasks/test_task.rb +4 -5
- metadata +58 -85
- data/.travis.yml +0 -39
- data/spec/compute/models/server_spec.rb +0 -229
- data/spec/compute_spec.rb +0 -95
- data/spec/connection_spec.rb +0 -105
- data/spec/core/cache_spec.rb +0 -191
- data/spec/core/model_spec.rb +0 -36
- data/spec/core/stringify_keys_spec.rb +0 -38
- data/spec/core/whitelist_keys_spec.rb +0 -36
- data/spec/credentials_spec.rb +0 -88
- data/spec/current_machine_spec.rb +0 -36
- data/spec/fake_app/fake_service.rb +0 -18
- data/spec/fake_app/models/collection.rb +0 -5
- data/spec/fake_app/models/model.rb +0 -2
- data/spec/fake_app/requests/request.rb +0 -11
- data/spec/fog_attribute_spec.rb +0 -549
- data/spec/formatador_spec.rb +0 -154
- data/spec/identity_spec.rb +0 -95
- data/spec/mocking_spec.rb +0 -84
- data/spec/service_spec.rb +0 -201
- data/spec/spec_helper.rb +0 -19
- data/spec/storage_spec.rb +0 -114
- data/spec/test_helpers/formats_helper_spec.rb +0 -121
- data/spec/test_helpers/schema_validator_spec.rb +0 -101
- data/spec/timeout_spec.rb +0 -20
- data/spec/utils_spec.rb +0 -29
- data/spec/uuid_spec.rb +0 -11
- data/spec/wait_for_spec.rb +0 -30
data/lib/fog/monitoring.rb
CHANGED
@@ -1,16 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Monitoring
|
3
3
|
extend Fog::ServicesMixin
|
4
|
-
|
5
|
-
def self.new(orig_attributes)
|
6
|
-
attributes = orig_attributes.dup
|
7
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
8
|
-
if provider == :stormondemand
|
9
|
-
require "fog/monitoring/storm_on_demand"
|
10
|
-
Fog::Monitoring::StormOnDemand.new(attributes)
|
11
|
-
else
|
12
|
-
super(orig_attributes)
|
13
|
-
end
|
14
|
-
end
|
15
4
|
end
|
16
5
|
end
|
data/lib/fog/network.rb
CHANGED
@@ -1,17 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Network
|
3
3
|
extend Fog::ServicesMixin
|
4
|
-
|
5
|
-
def self.new(orig_attributes)
|
6
|
-
attributes = orig_attributes.dup # Prevent delete from having side effects
|
7
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
8
|
-
|
9
|
-
if provider == :stormondemand
|
10
|
-
require "fog/network/storm_on_demand"
|
11
|
-
return Fog::Network::StormOnDemand.new(attributes)
|
12
|
-
else
|
13
|
-
super(orig_attributes)
|
14
|
-
end
|
15
|
-
end
|
16
4
|
end
|
17
5
|
end
|
data/lib/fog/storage.rb
CHANGED
@@ -1,28 +1,14 @@
|
|
1
1
|
begin
|
2
2
|
# Use mime/types/columnar if available, for reduced memory usage
|
3
|
-
require
|
3
|
+
require "mime/types/columnar"
|
4
4
|
rescue LoadError
|
5
|
-
require
|
5
|
+
require "mime/types"
|
6
6
|
end
|
7
7
|
|
8
8
|
module Fog
|
9
9
|
module Storage
|
10
10
|
extend Fog::ServicesMixin
|
11
11
|
|
12
|
-
def self.new(orig_attributes)
|
13
|
-
attributes = orig_attributes.dup # prevent delete from having side effects
|
14
|
-
case attributes.delete(:provider).to_s.downcase.to_sym
|
15
|
-
when :internetarchive
|
16
|
-
require "fog/internet_archive/storage"
|
17
|
-
Fog::Storage::InternetArchive.new(attributes)
|
18
|
-
when :stormondemand
|
19
|
-
require "fog/storage/storm_on_demand"
|
20
|
-
Fog::Storage::StormOnDemand.new(attributes)
|
21
|
-
else
|
22
|
-
super(orig_attributes)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
12
|
def self.directories
|
27
13
|
directories = []
|
28
14
|
providers.each do |provider|
|
@@ -38,18 +24,18 @@ module Fog
|
|
38
24
|
if body.respond_to?(:encoding)
|
39
25
|
original_encoding = body.encoding
|
40
26
|
body = body.dup if body.frozen?
|
41
|
-
body = body.force_encoding(
|
27
|
+
body = body.force_encoding("BINARY")
|
42
28
|
end
|
43
29
|
|
44
30
|
size = if body.respond_to?(:bytesize)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
31
|
+
body.bytesize
|
32
|
+
elsif body.respond_to?(:size)
|
33
|
+
body.size
|
34
|
+
elsif body.respond_to?(:stat)
|
35
|
+
body.stat.size
|
36
|
+
else
|
37
|
+
0
|
38
|
+
end
|
53
39
|
|
54
40
|
if body.respond_to?(:encoding)
|
55
41
|
body.force_encoding(original_encoding)
|
@@ -69,11 +55,10 @@ module Fog
|
|
69
55
|
|
70
56
|
def self.parse_data(data)
|
71
57
|
{
|
72
|
-
:
|
73
|
-
:
|
74
|
-
"Content-Length"
|
75
|
-
"Content-Type"
|
76
|
-
# "Content-MD5" => Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
|
58
|
+
body: data,
|
59
|
+
headers: {
|
60
|
+
"Content-Length" => get_body_size(data),
|
61
|
+
"Content-Type" => get_content_type(data)
|
77
62
|
}
|
78
63
|
}
|
79
64
|
end
|
data/lib/fog/support.rb
CHANGED
@@ -1,17 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module Support
|
3
3
|
extend Fog::ServicesMixin
|
4
|
-
|
5
|
-
def self.new(orig_attributes)
|
6
|
-
attributes = orig_attributes.dup
|
7
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
8
|
-
|
9
|
-
if provider == :stormondemand
|
10
|
-
require "fog/support/storm_on_demand"
|
11
|
-
Fog::Support::StormOnDemand.new(attributes)
|
12
|
-
else
|
13
|
-
super(orig_attributes)
|
14
|
-
end
|
15
|
-
end
|
16
4
|
end
|
17
5
|
end
|
@@ -35,6 +35,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
|
|
35
35
|
|
36
36
|
methods.each do |enum_method|
|
37
37
|
next unless collection.respond_to?(enum_method)
|
38
|
+
|
38
39
|
tests("##{enum_method}").succeeds do
|
39
40
|
block_called = false
|
40
41
|
collection.send(enum_method) { block_called = true }
|
@@ -44,6 +45,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
|
|
44
45
|
|
45
46
|
%w(max_by min_by).each do |enum_method|
|
46
47
|
next unless collection.respond_to?(enum_method)
|
48
|
+
|
47
49
|
tests("##{enum_method}").succeeds do
|
48
50
|
block_called = false
|
49
51
|
collection.send(enum_method) do
|
@@ -60,9 +60,9 @@ module Shindo
|
|
60
60
|
def formats(format, strict = true)
|
61
61
|
test("has proper format") do
|
62
62
|
if strict
|
63
|
-
options = { :
|
63
|
+
options = { allow_extra_keys: false, allow_optional_rules: true }
|
64
64
|
else
|
65
|
-
options = { :
|
65
|
+
options = { allow_extra_keys: true, allow_optional_rules: true }
|
66
66
|
end
|
67
67
|
validator = Fog::Schema::DataValidator.new
|
68
68
|
valid = validator.validate(yield, format, options)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "excon"
|
2
2
|
|
3
|
-
ENV["FOG_RC"] = ENV["FOG_RC"] || File.expand_path("
|
3
|
+
ENV["FOG_RC"] = ENV["FOG_RC"] || File.expand_path(".fog", __dir__)
|
4
4
|
ENV["FOG_CREDENTIAL"] = ENV["FOG_CREDENTIAL"] || "default"
|
5
5
|
|
6
|
-
Excon.defaults.merge!(:
|
6
|
+
Excon.defaults.merge!(debug_request: true, debug_response: true)
|
7
7
|
|
8
|
-
LOREM = <<HERE
|
8
|
+
LOREM = <<HERE.freeze
|
9
9
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
|
10
10
|
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
11
11
|
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "fog/schema/data_validator"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Minitest::Assertions
|
4
4
|
# Compares a hash's structure against a reference schema hash and returns true
|
5
5
|
# when they match. Fog::Schema::Datavalidator is used for the validation.
|
6
6
|
def assert_match_schema(actual, schema, message = nil, options = {})
|
@@ -9,91 +9,91 @@ Fog.mock! if ENV["FOG_MOCK"] == "true"
|
|
9
9
|
# if in mocked mode, fill in some fake credentials for us
|
10
10
|
if Fog.mock?
|
11
11
|
Fog.credentials = {
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
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
|
+
bluebox_api_key: "bluebox_api_key",
|
17
|
+
bluebox_customer_id: "bluebox_customer_id",
|
18
|
+
brightbox_client_id: "brightbox_client_id",
|
19
|
+
brightbox_secret: "brightbox_secret",
|
20
|
+
cloudstack_disk_offering_id: "",
|
21
|
+
cloudstack_host: "http://cloudstack.example.org",
|
22
|
+
cloudstack_network_ids: "",
|
23
|
+
cloudstack_service_offering_id: "4437ac6c-9fe3-477a-57ec-60a5a45896a4",
|
24
|
+
cloudstack_template_id: "8a31cf9c-f248-0588-256e-9dbf58785216",
|
25
|
+
cloudstack_zone_id: "c554c592-e09c-9df5-7688-4a32754a4305",
|
26
|
+
clodo_api_key: "clodo_api_key",
|
27
|
+
clodo_username: "clodo_username",
|
28
|
+
digitalocean_api_key: "digitalocean_api_key",
|
29
|
+
digitalocean_client_id: "digitalocean_client_id",
|
30
|
+
dnsimple_token: "dnsimple_token",
|
31
|
+
dnsimple_account: "dnsimple_account",
|
32
|
+
dnsmadeeasy_api_key: "dnsmadeeasy_api_key",
|
33
|
+
dnsmadeeasy_secret_key: "dnsmadeeasy_secret_key",
|
34
|
+
glesys_username: "glesys_username",
|
35
|
+
glesys_api_key: "glesys_api_key",
|
36
|
+
go_grid_api_key: "go_grid_api_key",
|
37
|
+
go_grid_shared_secret: "go_grid_shared_secret",
|
38
|
+
google_storage_access_key_id: "google_storage_access_key_id",
|
39
|
+
google_storage_secret_access_key: "google_storage_secret_access_key",
|
40
|
+
google_project: "google_project_name",
|
41
|
+
google_client_email: "fake@developer.gserviceaccount.com",
|
42
|
+
google_key_location: "~/fake.p12",
|
43
|
+
hp_access_key: "hp_access_key",
|
44
|
+
hp_secret_key: "hp_secret_key",
|
45
|
+
hp_tenant_id: "hp_tenant_id",
|
46
|
+
hp_avl_zone: "hp_avl_zone",
|
47
|
+
os_account_meta_temp_url_key: "os_account_meta_temp_url_key",
|
48
|
+
ibm_username: "ibm_username",
|
49
|
+
ibm_password: "ibm_password",
|
50
|
+
joyent_username: "joyentuser",
|
51
|
+
joyent_password: "joyentpass",
|
52
|
+
linode_api_key: "linode_api_key",
|
53
|
+
local_root: "~/.fog",
|
54
|
+
bare_metal_cloud_password: "bare_metal_cloud_password",
|
55
|
+
bare_metal_cloud_username: "bare_metal_cloud_username",
|
56
|
+
ninefold_compute_key: "ninefold_compute_key",
|
57
|
+
ninefold_compute_secret: "ninefold_compute_secret",
|
58
|
+
ninefold_storage_secret: "ninefold_storage_secret",
|
59
|
+
ninefold_storage_token: "ninefold_storage_token",
|
60
60
|
# :public_key_path => "~/.ssh/id_rsa.pub",
|
61
61
|
# :private_key_path => "~/.ssh/id_rsa",
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
89
|
-
:
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
94
|
-
:
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
62
|
+
openstack_api_key: "openstack_api_key",
|
63
|
+
openstack_username: "openstack_username",
|
64
|
+
openstack_tenant: "openstack_tenant",
|
65
|
+
openstack_auth_url: "http://openstack:35357/v2.0/tokens",
|
66
|
+
ovirt_url: "http://ovirt:8080/api",
|
67
|
+
ovirt_username: "admin@internal",
|
68
|
+
ovirt_password: "123123",
|
69
|
+
rackspace_api_key: "rackspace_api_key",
|
70
|
+
rackspace_username: "rackspace_username",
|
71
|
+
riakcs_access_key_id: "riakcs_access_key_id",
|
72
|
+
riakcs_secret_access_key: "riakcs_secret_access_key",
|
73
|
+
vcloud_host: "vcloud_host",
|
74
|
+
vcloud_password: "vcloud_password",
|
75
|
+
vcloud_username: "vcloud_username",
|
76
|
+
vcloud_director_host: "vcloud-director-host",
|
77
|
+
vcloud_director_password: "vcloud_director_password",
|
78
|
+
vcloud_director_username: "vcd_user@vcd_org_name",
|
79
|
+
voxel_api_key: "voxel_api_key",
|
80
|
+
voxel_api_secret: "voxel_api_secret",
|
81
|
+
zerigo_email: "zerigo_email",
|
82
|
+
zerigo_token: "zerigo_token",
|
83
|
+
dynect_customer: "dynect_customer",
|
84
|
+
dynect_username: "dynect_username",
|
85
|
+
dynect_password: "dynect_password",
|
86
|
+
vsphere_server: "virtualcenter.lan",
|
87
|
+
vsphere_username: "apiuser",
|
88
|
+
vsphere_password: "apipassword",
|
89
|
+
vsphere_expected_pubkey_hash: "abcdef1234567890",
|
90
|
+
libvirt_uri: "qemu:///system",
|
91
|
+
libvirt_username: "root",
|
92
|
+
libvirt_password: "password",
|
93
|
+
cloudsigma_username: "csuname",
|
94
|
+
cloudsigma_password: "cspass",
|
95
|
+
kubevirt_token: "[TOKEN]",
|
96
|
+
kubevirt_hostname: "localhost",
|
97
|
+
kubevirt_port: "6443"
|
98
98
|
}.merge(Fog.credentials)
|
99
99
|
end
|
data/lib/fog/vpn.rb
CHANGED
@@ -1,17 +1,5 @@
|
|
1
1
|
module Fog
|
2
2
|
module VPN
|
3
3
|
extend Fog::ServicesMixin
|
4
|
-
|
5
|
-
def self.new(orig_attributes)
|
6
|
-
attributes = orig_attributes.dup
|
7
|
-
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
8
|
-
|
9
|
-
if provider == :stormondemand
|
10
|
-
require "fog/vpn/storm_on_demand"
|
11
|
-
Fog::VPN::StormOnDemand.new(attributes)
|
12
|
-
else
|
13
|
-
super(orig_attributes)
|
14
|
-
end
|
15
|
-
end
|
16
4
|
end
|
17
5
|
end
|
data/lib/tasks/test_task.rb
CHANGED
@@ -22,13 +22,12 @@ module Fog
|
|
22
22
|
def tests(mocked)
|
23
23
|
Fog::Formatador.display_line
|
24
24
|
start = Time.now.to_i
|
25
|
-
threads = []
|
26
25
|
Thread.main[:results] = []
|
27
|
-
Fog.providers.
|
28
|
-
|
26
|
+
threads = Fog.providers.map do |key, value|
|
27
|
+
Thread.new do
|
29
28
|
Thread.main[:results] << {
|
30
|
-
:
|
31
|
-
:
|
29
|
+
provider: value,
|
30
|
+
success: sh("export FOG_MOCK=#{mocked} && bundle exec shindont +#{key}")
|
32
31
|
}
|
33
32
|
end
|
34
33
|
end
|