fog 1.33.0 → 1.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/Rakefile +3 -0
  4. data/fog.gemspec +4 -4
  5. data/lib/fog/openstack/baremetal.rb +20 -82
  6. data/lib/fog/openstack/compute.rb +11 -34
  7. data/lib/fog/openstack/core.rb +37 -10
  8. data/lib/fog/openstack/identity.rb +33 -44
  9. data/lib/fog/openstack/identity_v2.rb +14 -84
  10. data/lib/fog/openstack/identity_v3.rb +4 -51
  11. data/lib/fog/openstack/image.rb +22 -83
  12. data/lib/fog/openstack/metering.rb +15 -76
  13. data/lib/fog/openstack/models/compute/server.rb +1 -1
  14. data/lib/fog/openstack/models/orchestration/events.rb +1 -0
  15. data/lib/fog/openstack/models/orchestration/resources.rb +1 -0
  16. data/lib/fog/openstack/models/orchestration/stack.rb +1 -1
  17. data/lib/fog/openstack/models/orchestration/stacks.rb +1 -0
  18. data/lib/fog/openstack/models/orchestration/templates.rb +1 -0
  19. data/lib/fog/openstack/network.rb +21 -21
  20. data/lib/fog/openstack/orchestration.rb +11 -91
  21. data/lib/fog/openstack/planning.rb +19 -81
  22. data/lib/fog/openstack/requests/compute/list_security_groups.rb +9 -1
  23. data/lib/fog/openstack/requests/network/add_router_interface.rb +12 -4
  24. data/lib/fog/openstack/requests/network/create_port.rb +14 -12
  25. data/lib/fog/openstack/requests/network/get_port.rb +4 -0
  26. data/lib/fog/openstack/requests/network/set_tenant.rb +1 -0
  27. data/lib/fog/openstack/storage.rb +18 -57
  28. data/lib/fog/openstack/volume.rb +17 -79
  29. data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +13 -2
  30. data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +7 -6
  31. data/lib/fog/vcloud_director/models/compute/vm_customizations.rb +15 -0
  32. data/lib/fog/version.rb +1 -1
  33. data/lib/tasks/changelog_task.rb +1 -0
  34. data/spec/fog/openstack/volume_spec.rb +5 -0
  35. data/tests/compute/helper.rb +0 -6
  36. data/tests/openstack/requests/network/port_tests.rb +14 -12
  37. data/tests/rackspace/requests/storage/object_tests.rb +46 -4
  38. data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +2 -2
  39. metadata +11 -74
  40. data/lib/fog/bin/dynect.rb +0 -28
  41. data/tests/brightbox/compute/helper.rb +0 -1
  42. data/tests/brightbox/compute/schema.rb +0 -799
  43. data/tests/brightbox/compute_tests.rb +0 -101
  44. data/tests/brightbox/helper.rb +0 -1
  45. data/tests/brightbox/models/compute/account_tests.rb +0 -17
  46. data/tests/brightbox/models/compute/cloud_ip_tests.rb +0 -32
  47. data/tests/brightbox/models/compute/database_server_tests.rb +0 -78
  48. data/tests/brightbox/models/compute/database_snapshot_tests.rb +0 -26
  49. data/tests/brightbox/models/compute/database_type_tests.rb +0 -27
  50. data/tests/brightbox/models/compute/server_tests.rb +0 -19
  51. data/tests/brightbox/oauth2_tests.rb +0 -110
  52. data/tests/brightbox/requests/compute/account_tests.rb +0 -65
  53. data/tests/brightbox/requests/compute/api_client_tests.rb +0 -64
  54. data/tests/brightbox/requests/compute/application_test.rb +0 -63
  55. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +0 -85
  56. data/tests/brightbox/requests/compute/collaboration_tests.rb +0 -39
  57. data/tests/brightbox/requests/compute/database_server_tests.rb +0 -54
  58. data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +0 -47
  59. data/tests/brightbox/requests/compute/database_type_tests.rb +0 -17
  60. data/tests/brightbox/requests/compute/firewall_policy_tests.rb +0 -40
  61. data/tests/brightbox/requests/compute/firewall_rule_tests.rb +0 -43
  62. data/tests/brightbox/requests/compute/helper.rb +0 -41
  63. data/tests/brightbox/requests/compute/image_tests.rb +0 -60
  64. data/tests/brightbox/requests/compute/interface_tests.rb +0 -33
  65. data/tests/brightbox/requests/compute/load_balancer_tests.rb +0 -121
  66. data/tests/brightbox/requests/compute/server_group_tests.rb +0 -96
  67. data/tests/brightbox/requests/compute/server_tests.rb +0 -99
  68. data/tests/brightbox/requests/compute/server_type_tests.rb +0 -34
  69. data/tests/brightbox/requests/compute/user_collaboration_tests.rb +0 -67
  70. data/tests/brightbox/requests/compute/user_tests.rb +0 -38
  71. data/tests/brightbox/requests/compute/zone_tests.rb +0 -34
@@ -1,101 +0,0 @@
1
- Shindo.tests('Fog::Compute[:brightbox]', ['brightbox']) do
2
-
3
- @test_service = Fog::Compute[:brightbox]
4
-
5
- tests("#respond_to? :default_image").returns(true) do
6
- @test_service.respond_to?(:default_image)
7
- end
8
-
9
- end
10
-
11
- Shindo.tests('Fog::Compute.new', ['brightbox']) do
12
-
13
- tests("service options") do
14
- {
15
- :brightbox_api_url => "https://example.com",
16
- :brightbox_auth_url => "https://example.com",
17
- :brightbox_client_id => "app-12345",
18
- :brightbox_secret => "12345abdef6789",
19
- :brightbox_username => "user-12345",
20
- :brightbox_password => "password1234",
21
- :brightbox_account => "acc-12345",
22
- :brightbox_access_token => "12345abdef6789",
23
- :brightbox_refresh_token => "12345abdef6789",
24
- :brightbox_token_management => false
25
- }.each_pair do |option, sample|
26
- tests("recognises :#{option}").returns(true) do
27
- options = {:provider => "Brightbox"}
28
- options[option] = sample
29
- begin
30
- Fog::Compute.new(options)
31
- true
32
- rescue ArgumentError
33
- false
34
- end
35
- end
36
- end
37
- end
38
-
39
- tests("automatic token management") do
40
- service_options = {:provider => "Brightbox"}
41
-
42
- tests("when enabled (default)") do
43
- service_options[:brightbox_token_management] = true
44
-
45
- tests("using bad token") do
46
- service_options[:brightbox_access_token] = "bad-token"
47
-
48
- tests("#request").returns(true, "returns a Hash") do
49
- pending if Fog.mocking?
50
- service = Fog::Compute.new(service_options)
51
- response = service.get_authenticated_user
52
- response.is_a?(Hash) # This is an outstanding issue, should be Excon::Response
53
- end
54
- end
55
- end
56
-
57
- tests("when disabled") do
58
- service_options[:brightbox_token_management] = false
59
-
60
- tests("using bad token") do
61
- service_options[:brightbox_access_token] = "bad-token"
62
-
63
- tests("#request").raises(Excon::Errors::Unauthorized) do
64
- pending if Fog.mocking?
65
- service = Fog::Compute.new(service_options)
66
- service.get_authenticated_user
67
- end
68
- end
69
- end
70
- end
71
-
72
- tests("account scoping") do
73
- service = Fog::Compute.new(:provider => "Brightbox")
74
- configured_account = Fog.credentials[:brightbox_account]
75
- tests("when Fog.credentials are #{configured_account}") do
76
- test("#scoped_account == #{configured_account}") { service.scoped_account == configured_account }
77
- end
78
-
79
- set_account = "acc-35791"
80
- tests("when Compute instance is updated to #{set_account}") do
81
- service.scoped_account = set_account
82
- test("#scoped_account == #{set_account}") { service.scoped_account == set_account }
83
- end
84
-
85
- tests("when Compute instance is reset") do
86
- service.scoped_account_reset
87
- test("#scoped_account == #{configured_account}") { service.scoped_account == configured_account }
88
- end
89
-
90
- optioned_account = "acc-56789"
91
- tests("when Compute instance created with :brightbox_account => #{optioned_account}") do
92
- service = Fog::Compute.new(:provider => "Brightbox", :brightbox_account => optioned_account )
93
- test("#scoped_account == #{optioned_account}") { service.scoped_account == optioned_account }
94
- end
95
-
96
- request_account = "acc-24680"
97
- tests("when requested with #{request_account}") do
98
- test("#scoped_account(#{request_account}) == #{request_account}") { service.scoped_account(request_account) == request_account }
99
- end
100
- end
101
- end
@@ -1 +0,0 @@
1
- Excon.defaults[:ssl_verify_peer] = false
@@ -1,17 +0,0 @@
1
- Shindo.tests("Fog::Compute[:brightbox] | Account model", ["brightbox"]) do
2
-
3
- pending if Fog.mocking?
4
-
5
- @account = Fog::Compute[:brightbox].account
6
-
7
- tests("success") do
8
-
9
- tests("#reset_ftp_password") do
10
- pending if Fog.mocking?
11
- test("original ftp password is blanked") { @account.library_ftp_password.nil? }
12
- @new_password = @account.reset_ftp_password
13
- test("new ftp password was not nil") { !@new_password.nil? }
14
- test("new ftp password is set") { @account.library_ftp_password == @new_password }
15
- end
16
- end
17
- end
@@ -1,32 +0,0 @@
1
- Shindo.tests("Fog::Compute[:brightbox] | CloudIp model", ["brightbox"]) do
2
- pending if Fog.mocking?
3
-
4
- @test_service = Fog::Compute[:brightbox]
5
-
6
- tests("success") do
7
- @server = Brightbox::Compute::TestSupport.get_test_server
8
- server_id = @server.id
9
-
10
- @cip = @test_service.cloud_ips.allocate
11
-
12
- tests("#destination_id") do
13
- returns(true) do
14
- @cip.respond_to?(:destination_id)
15
- end
16
-
17
- @cip.map(@server)
18
- @cip.wait_for { mapped? }
19
-
20
- returns(server_id) do
21
- @cip.destination_id
22
- end
23
-
24
- @cip.unmap
25
- @cip.wait_for { !mapped? }
26
- end
27
-
28
- @cip.destroy
29
-
30
- @server.destroy
31
- end
32
- end
@@ -1,78 +0,0 @@
1
- Shindo.tests("Fog::Compute[:brightbox] | DatabaseServer model", ["brightbox"]) do
2
- pending if Fog.mocking?
3
-
4
- @service = Fog::Compute[:brightbox]
5
-
6
- tests("success") do
7
- tests("#create") do
8
- test("a new database server is returned") do
9
- @database_server = @service.database_servers.create
10
- !@database_server.nil?
11
- end
12
-
13
- test("state is not nil") do
14
- !@database_server.state.nil?
15
- end
16
-
17
- test("database_version is not nil") do
18
- !@database_server.database_version.nil?
19
- end
20
-
21
- test("admin_username is not nil") do
22
- !@database_server.admin_username.nil?
23
- end
24
-
25
- test("admin_password is not nil") do
26
- !@database_server.admin_password.nil?
27
- end
28
- end
29
-
30
- @sample_identifier = @database_server.id
31
- pending if @sample_identifier.nil?
32
-
33
- tests("#all") do
34
- test("returns results") do
35
- @database_servers = @service.database_servers.all
36
- @database_servers.any? do |dbs|
37
- dbs.identity == @database_server.identity
38
- end
39
- end
40
- end
41
-
42
- tests("#get('#{@sample_identifier}')") do
43
- @database_server = @service.database_servers.get(@sample_identifier)
44
-
45
- @database_server.wait_for { ready? }
46
-
47
- test("admin_username is not nil") do
48
- !@database_server.admin_username.nil?
49
- end
50
-
51
- test("admin_password is nil") do
52
- @database_server.admin_password.nil?
53
- end
54
- end
55
-
56
- @database_server.wait_for { ready? }
57
-
58
- tests("#snapshot") do
59
- # Very messy but there is no feedback about if snapshotting or what the ID will be
60
- existing_snapshots = @service.database_snapshots.all.map { |snapshot| snapshot.identity }
61
- test do
62
- @database_server.snapshot
63
- end
64
-
65
- current_snapshots = @service.database_snapshots.all.map { |snapshot| snapshot.identity }
66
- snapshot_id = (current_snapshots - existing_snapshots).last
67
-
68
- @snapshot = @service.database_snapshots.get(snapshot_id)
69
- @snapshot.wait_for { ready? }
70
- @snapshot.destroy
71
- end
72
-
73
- # Can no longer destroy when snapshotting
74
- tests("#destroy") do
75
- @database_server.destroy
76
- end
77
- end
78
- end
@@ -1,26 +0,0 @@
1
- Shindo.tests("Fog::Compute[:brightbox] | DatabaseSnapshot model", ["brightbox"]) do
2
- pending if Fog.mocking?
3
-
4
- @service = Fog::Compute[:brightbox]
5
-
6
- tests("success") do
7
- tests("#all") do
8
- test("returns results") do
9
- @database_snapshots = @service.database_snapshots.all
10
- !@database_snapshots.empty?
11
- end
12
- end
13
-
14
- pending if @database_snapshots.empty?
15
- @sample_identifier = @database_snapshots.first.identity
16
- tests("#get('#{@sample_identifier}')") do
17
- @database_snapshot = @service.database_snapshots.get(@sample_identifier)
18
- end
19
-
20
- # @database_snapshot.wait_for { ready? }
21
-
22
- # tests("#destroy") do
23
- # @database_snapshot.destroy
24
- # end
25
- end
26
- end
@@ -1,27 +0,0 @@
1
- Shindo.tests("Fog::Compute[:brightbox] | DatabaseType model", ["brightbox"]) do
2
- pending if Fog.mocking?
3
-
4
- @service = Fog::Compute[:brightbox]
5
-
6
- tests("success") do
7
- tests("#all") do
8
- @database_types = @service.database_types.all
9
- test("returns results") { !@database_types.empty? }
10
- end
11
-
12
- @sample_identifier = @database_types.first.id
13
- pending if @sample_identifier.nil?
14
-
15
- tests("#get(#{@sample_identifier})") do
16
- @database_type = @service.database_types.get(@sample_identifier)
17
-
18
- test("disk is not nil") do
19
- !@database_type.disk.nil?
20
- end
21
-
22
- test("ram is not nil") do
23
- !@database_type.ram.nil?
24
- end
25
- end
26
- end
27
- end
@@ -1,19 +0,0 @@
1
- Shindo.tests("Fog::Compute[:brightbox] | Server model", ["brightbox"]) do
2
- pending if Fog.mocking?
3
-
4
- tests("success") do
5
- @server = Brightbox::Compute::TestSupport.get_test_server
6
- server_id = @server.id
7
-
8
- tests("#dns_name") do
9
- returns("public.#{@server.fqdn}") { @server.dns_name }
10
- end
11
-
12
- tests("#mapping_identity") do
13
- first_interface_id = @server.interfaces.first["id"]
14
- returns(first_interface_id) { @server.mapping_identity }
15
- end
16
-
17
- @server.destroy
18
- end
19
- end
@@ -1,110 +0,0 @@
1
- Shindo.tests("Fog::Brightbox::OAuth2", ["brightbox"]) do
2
-
3
- tests("CredentialSet") do
4
- @client_id = "app-12345"
5
- @client_secret = "__mashed_keys_123__"
6
- @username = "usr-12345"
7
- @password = "__mushed_keys_321__"
8
- @access_token = "12efde32fdfe4989"
9
- @refresh_token = "7894389f9074f071"
10
- @expires_in = 7200
11
-
12
- tests("with client credentials") do
13
- credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret)
14
- tests("#user_details?").returns(false) { credentials.user_details? }
15
- tests("#access_token?").returns(false) { credentials.access_token? }
16
- tests("#refresh_token?").returns(false) { credentials.refresh_token? }
17
- tests("#best_grant_strategy").returns(true) do
18
- credentials.best_grant_strategy.is_a?(Fog::Brightbox::OAuth2::ClientCredentialsStrategy)
19
- end
20
- end
21
-
22
- tests("with user credentials") do
23
- options = {:username => @username, :password => @password}
24
- credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
25
- tests("#user_details?").returns(true) { credentials.user_details? }
26
- tests("#access_token?").returns(false) { credentials.access_token? }
27
- tests("#refresh_token?").returns(false) { credentials.refresh_token? }
28
- tests("#best_grant_strategy").returns(true) do
29
- credentials.best_grant_strategy.is_a?(Fog::Brightbox::OAuth2::UserCredentialsStrategy)
30
- end
31
- end
32
-
33
- tests("with existing tokens") do
34
- options = {
35
- :username => @username,
36
- :access_token => @access_token,
37
- :refresh_token => @refresh_token,
38
- :expires_in => @expires_in
39
- }
40
- credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
41
- tests("#user_details?").returns(false) { credentials.user_details? }
42
- tests("#access_token?").returns(true) { credentials.access_token? }
43
- tests("#refresh_token?").returns(true) { credentials.refresh_token? }
44
- tests("#expires_in").returns(7200) { credentials.expires_in }
45
- tests("#best_grant_strategy").returns(true) do
46
- credentials.best_grant_strategy.is_a?(Fog::Brightbox::OAuth2::RefreshTokenStrategy)
47
- end
48
- end
49
- end
50
-
51
- tests("GrantTypeStrategy") do
52
- credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret)
53
- strategy = Fog::Brightbox::OAuth2::GrantTypeStrategy.new(credentials)
54
-
55
- tests("#respond_to? :authorization_body_data").returns(true) do
56
- strategy.respond_to?(:authorization_body_data)
57
- end
58
- end
59
-
60
- tests("ClientCredentialsStrategy") do
61
- credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret)
62
- strategy = Fog::Brightbox::OAuth2::ClientCredentialsStrategy.new(credentials)
63
-
64
- tests("#respond_to? :authorization_body_data").returns(true) do
65
- strategy.respond_to?(:authorization_body_data)
66
- end
67
-
68
- tests("#authorization_body_data") do
69
- authorization_body_data = strategy.authorization_body_data
70
- test("grant_type == none") { authorization_body_data["grant_type"] == "none" }
71
- test("client_id == #{@client_id}") { authorization_body_data["client_id"] == @client_id }
72
- end
73
- end
74
-
75
- tests("UserCredentialsStrategy") do
76
- options = {:username => @username, :password => @password}
77
- credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
78
- strategy = Fog::Brightbox::OAuth2::UserCredentialsStrategy.new(credentials)
79
-
80
- tests("#respond_to? :authorization_body_data").returns(true) do
81
- strategy.respond_to?(:authorization_body_data)
82
- end
83
-
84
- tests("#authorization_body_data") do
85
- authorization_body_data = strategy.authorization_body_data
86
- test("grant_type == password") { authorization_body_data["grant_type"] == "password" }
87
- test("client_id == #{@client_id}") { authorization_body_data["client_id"] == @client_id }
88
- test("username == #{@username}") { authorization_body_data["username"] == @username }
89
- test("password == #{@password}") { authorization_body_data["password"] == @password }
90
- end
91
- end
92
-
93
- tests("RefreshTokenStrategy") do
94
- refresh_token = "ab4b39dddf909"
95
- options = {:refresh_token => refresh_token}
96
- credentials = Fog::Brightbox::OAuth2::CredentialSet.new(@client_id, @client_secret, options)
97
- strategy = Fog::Brightbox::OAuth2::RefreshTokenStrategy.new(credentials)
98
-
99
- tests("#respond_to? :authorization_body_data").returns(true) do
100
- strategy.respond_to?(:authorization_body_data)
101
- end
102
-
103
- tests("#authorization_body_data") do
104
- authorization_body_data = strategy.authorization_body_data
105
- test("grant_type == refresh_token") { authorization_body_data["grant_type"] == "refresh_token" }
106
- test("client_id == #{@client_id}") { authorization_body_data["client_id"] == @client_id }
107
- test("refresh_token == #{refresh_token}") { authorization_body_data["refresh_token"] == refresh_token }
108
- end
109
- end
110
- end
@@ -1,65 +0,0 @@
1
- Shindo.tests('Fog::Compute[:brightbox] | account requests', ['brightbox']) do
2
-
3
- tests('success') do
4
-
5
- tests("#list_accounts") do
6
- pending if Fog.mocking?
7
- result = Fog::Compute[:brightbox].list_accounts
8
- data_matches_schema(Brightbox::Compute::Formats::Collection::ACCOUNTS, {:allow_extra_keys => true}) { result }
9
- end
10
-
11
- tests("#get_scoped_account") do
12
- pending if Fog.mocking?
13
- result = Fog::Compute[:brightbox].get_scoped_account
14
- @scoped_account_identifier = result["id"]
15
- data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
16
- test("ftp password is blanked") { result["library_ftp_password"].nil? }
17
- end
18
-
19
- tests("#get_account(#{@scoped_account_identifier}") do
20
- pending if Fog.mocking?
21
- result = Fog::Compute[:brightbox].get_account(@scoped_account_identifier)
22
- @current_name = result["name"]
23
- data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
24
- test("ftp password is blanked") { result["library_ftp_password"].nil? }
25
- end
26
-
27
- update_options = { :name => @current_name }
28
- tests("#update_scoped_account(#{update_options.inspect})") do
29
- pending if Fog.mocking?
30
- result = Fog::Compute[:brightbox].update_scoped_account(update_options)
31
- data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
32
- end
33
-
34
- tests("#update_account(#{@scoped_account_identifier}, #{update_options.inspect})") do
35
- pending if Fog.mocking?
36
- result = Fog::Compute[:brightbox].update_account(@scoped_account_identifier, update_options)
37
- data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
38
- end
39
-
40
- tests("#reset_ftp_password_scoped_account") do
41
- pending if Fog.mocking?
42
- result = Fog::Compute[:brightbox].reset_ftp_password_scoped_account
43
- data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
44
- test("new ftp password is visible") { ! result["library_ftp_password"].nil? }
45
- end
46
-
47
- tests("#reset_ftp_password_account(#{@scoped_account_identifier})") do
48
- pending if Fog.mocking?
49
- result = Fog::Compute[:brightbox].reset_ftp_password_account(@scoped_account_identifier)
50
- data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
51
- test("new ftp password is visible") { ! result["library_ftp_password"].nil? }
52
- end
53
-
54
- end
55
-
56
- tests('failure') do
57
-
58
- tests("#update_account").raises(ArgumentError) do
59
- pending if Fog.mocking?
60
- Fog::Compute[:brightbox].update_account
61
- end
62
-
63
- end
64
-
65
- end