fog 2.0.0 → 2.1.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.
Files changed (117) hide show
  1. checksums.yaml +5 -5
  2. data/.github/stale.yml +17 -0
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +37 -0
  5. data/README.md +3 -3
  6. data/fog.gemspec +6 -6
  7. data/lib/fog.rb +0 -1
  8. data/lib/fog/bin.rb +0 -1
  9. data/lib/fog/bin/brightbox.rb +2 -2
  10. data/lib/fog/cloudstack/models/compute/server.rb +2 -0
  11. data/lib/fog/linode/requests/compute/avail_datacenters.rb +1 -0
  12. data/lib/fog/opennebula/compute.rb +6 -1
  13. data/lib/fog/opennebula/requests/compute/OpenNebulaVNC.rb +5 -1
  14. data/lib/fog/version.rb +1 -1
  15. data/lib/tasks/changelog_task.rb +1 -0
  16. data/spec/fog/bin/atmos_spec.rb +0 -10
  17. data/spec/fog/bin/aws_spec.rb +0 -18
  18. data/spec/fog/bin/baremetalcloud_spec.rb +0 -10
  19. data/spec/fog/bin/brightbox_spec.rb +2 -2
  20. data/spec/fog/bin_spec.rb +0 -3
  21. data/tests/cloudsigma/models/snapshot_tests.rb +2 -0
  22. data/tests/cloudsigma/models/snapshots_tests.rb +1 -0
  23. data/tests/cloudsigma/requests/snapshots_tests.rb +1 -0
  24. data/tests/cloudsigma/requests/volumes_tests.rb +1 -1
  25. data/tests/cloudstack/compute/models/volume_tests.rb +1 -1
  26. data/tests/compute/helper.rb +0 -9
  27. data/tests/dns/helper.rb +0 -6
  28. data/tests/helpers/mock_helper.rb +0 -2
  29. data/tests/opennebula/compute_tests.rb +5 -2
  30. data/tests/opennebula/models/compute/flavor_tests.rb +5 -1
  31. data/tests/opennebula/models/compute/flavors_tests.rb +5 -2
  32. data/tests/opennebula/models/compute/group_tests.rb +5 -2
  33. data/tests/opennebula/models/compute/groups_tests.rb +5 -2
  34. data/tests/opennebula/models/compute/network_tests.rb +5 -1
  35. data/tests/opennebula/models/compute/networks_tests.rb +5 -2
  36. data/tests/opennebula/requests/compute/vm_allocate_tests.rb +5 -1
  37. data/tests/opennebula/requests/compute/vm_suspend_resume_tests.rb +5 -2
  38. metadata +26 -375
  39. data/lib/fog/bin/bluebox.rb +0 -36
  40. data/lib/fog/bluebox.rb +0 -3
  41. data/lib/fog/bluebox/blb.rb +0 -82
  42. data/lib/fog/bluebox/compute.rb +0 -98
  43. data/lib/fog/bluebox/core.rb +0 -12
  44. data/lib/fog/bluebox/dns.rb +0 -101
  45. data/lib/fog/bluebox/models/blb/lb_application.rb +0 -29
  46. data/lib/fog/bluebox/models/blb/lb_applications.rb +0 -24
  47. data/lib/fog/bluebox/models/blb/lb_backend.rb +0 -19
  48. data/lib/fog/bluebox/models/blb/lb_backends.rb +0 -27
  49. data/lib/fog/bluebox/models/blb/lb_service.rb +0 -32
  50. data/lib/fog/bluebox/models/blb/lb_services.rb +0 -27
  51. data/lib/fog/bluebox/models/compute/flavor.rb +0 -41
  52. data/lib/fog/bluebox/models/compute/flavors.rb +0 -24
  53. data/lib/fog/bluebox/models/compute/image.rb +0 -30
  54. data/lib/fog/bluebox/models/compute/images.rb +0 -24
  55. data/lib/fog/bluebox/models/compute/location.rb +0 -13
  56. data/lib/fog/bluebox/models/compute/locations.rb +0 -24
  57. data/lib/fog/bluebox/models/compute/server.rb +0 -121
  58. data/lib/fog/bluebox/models/compute/servers.rb +0 -32
  59. data/lib/fog/bluebox/models/dns/record.rb +0 -52
  60. data/lib/fog/bluebox/models/dns/records.rb +0 -32
  61. data/lib/fog/bluebox/models/dns/zone.rb +0 -62
  62. data/lib/fog/bluebox/models/dns/zones.rb +0 -24
  63. data/lib/fog/bluebox/parsers/dns/create_record.rb +0 -22
  64. data/lib/fog/bluebox/parsers/dns/create_zone.rb +0 -22
  65. data/lib/fog/bluebox/parsers/dns/get_record.rb +0 -17
  66. data/lib/fog/bluebox/parsers/dns/get_records.rb +0 -24
  67. data/lib/fog/bluebox/parsers/dns/get_zone.rb +0 -22
  68. data/lib/fog/bluebox/parsers/dns/get_zones.rb +0 -26
  69. data/lib/fog/bluebox/requests/blb/add_machine_to_lb_application.rb +0 -33
  70. data/lib/fog/bluebox/requests/blb/add_machine_to_lb_backend.rb +0 -31
  71. data/lib/fog/bluebox/requests/blb/get_lb_application.rb +0 -32
  72. data/lib/fog/bluebox/requests/blb/get_lb_applications.rb +0 -30
  73. data/lib/fog/bluebox/requests/blb/get_lb_backend.rb +0 -35
  74. data/lib/fog/bluebox/requests/blb/get_lb_backends.rb +0 -35
  75. data/lib/fog/bluebox/requests/blb/get_lb_machine.rb +0 -34
  76. data/lib/fog/bluebox/requests/blb/get_lb_machines.rb +0 -34
  77. data/lib/fog/bluebox/requests/blb/get_lb_service.rb +0 -35
  78. data/lib/fog/bluebox/requests/blb/get_lb_services.rb +0 -35
  79. data/lib/fog/bluebox/requests/blb/remove_machine_from_lb_backend.rb +0 -28
  80. data/lib/fog/bluebox/requests/blb/update_lb_backend_machine.rb +0 -29
  81. data/lib/fog/bluebox/requests/compute/create_block.rb +0 -44
  82. data/lib/fog/bluebox/requests/compute/create_template.rb +0 -25
  83. data/lib/fog/bluebox/requests/compute/destroy_block.rb +0 -24
  84. data/lib/fog/bluebox/requests/compute/destroy_template.rb +0 -24
  85. data/lib/fog/bluebox/requests/compute/get_block.rb +0 -24
  86. data/lib/fog/bluebox/requests/compute/get_blocks.rb +0 -26
  87. data/lib/fog/bluebox/requests/compute/get_location.rb +0 -24
  88. data/lib/fog/bluebox/requests/compute/get_locations.rb +0 -22
  89. data/lib/fog/bluebox/requests/compute/get_product.rb +0 -24
  90. data/lib/fog/bluebox/requests/compute/get_products.rb +0 -23
  91. data/lib/fog/bluebox/requests/compute/get_template.rb +0 -24
  92. data/lib/fog/bluebox/requests/compute/get_templates.rb +0 -24
  93. data/lib/fog/bluebox/requests/compute/reboot_block.rb +0 -25
  94. data/lib/fog/bluebox/requests/dns/create_record.rb +0 -44
  95. data/lib/fog/bluebox/requests/dns/create_zone.rb +0 -48
  96. data/lib/fog/bluebox/requests/dns/delete_record.rb +0 -27
  97. data/lib/fog/bluebox/requests/dns/delete_zone.rb +0 -27
  98. data/lib/fog/bluebox/requests/dns/get_record.rb +0 -36
  99. data/lib/fog/bluebox/requests/dns/get_records.rb +0 -37
  100. data/lib/fog/bluebox/requests/dns/get_zone.rb +0 -40
  101. data/lib/fog/bluebox/requests/dns/get_zones.rb +0 -39
  102. data/lib/fog/bluebox/requests/dns/update_record.rb +0 -30
  103. data/lib/fog/bluebox/requests/dns/update_zone.rb +0 -26
  104. data/lib/fog/ovirt.rb +0 -1
  105. data/lib/fog/ovirt/requests/compute/activate_volume.rb +0 -22
  106. data/lib/fog/ovirt/requests/compute/deactivate_volume.rb +0 -22
  107. data/spec/fog/bin/bluebox_spec.rb +0 -55
  108. data/spec/fog/compute_spec.rb +0 -19
  109. data/spec/fog/dns_spec.rb +0 -19
  110. data/tests/bluebox/requests/blb/helper.rb +0 -64
  111. data/tests/bluebox/requests/blb/lb_tests.rb +0 -75
  112. data/tests/bluebox/requests/compute/block_tests.rb +0 -83
  113. data/tests/bluebox/requests/compute/helper.rb +0 -16
  114. data/tests/bluebox/requests/compute/location_tests.rb +0 -32
  115. data/tests/bluebox/requests/compute/product_tests.rb +0 -34
  116. data/tests/bluebox/requests/compute/template_tests.rb +0 -37
  117. data/tests/bluebox/requests/dns/dns_tests.rb +0 -258
@@ -1,19 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Fog::Compute do
4
- Fog::Compute.providers.each do |provider|
5
- describe "when #{provider} is passed with no available credentials" do
6
- it "returns ArgumentError" do
7
- # Stub credentials so you still see errors where the tester really has credentials
8
- Fog.stub :credentials, {} do
9
- # These providers do not raise ArgumentError since they have no requirements defined
10
- if [:openvz, :vmfusion].include?(provider)
11
- assert Fog::Compute[provider]
12
- else
13
- assert_raises(ArgumentError) { Fog::Compute[provider] }
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Fog::DNS do
4
- Fog::DNS.providers.each do |provider|
5
- describe "when #{provider} is passed with no available credentials" do
6
- it "returns ArgumentError" do
7
- # Stub credentials so you still see errors where the tester really has credentials
8
- Fog.stub :credentials, {} do
9
- # These providers do not raise ArgumentError since they have no requirements defined
10
- if [:dnsimple].include?(provider)
11
- assert Fog::DNS[provider]
12
- else
13
- assert_raises(ArgumentError) { Fog::DNS[provider] }
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,64 +0,0 @@
1
- class Bluebox
2
- module BLB
3
- module Formats
4
- LB_APPLICATION = {
5
- 'id' => String,
6
- 'ip_v4' => String,
7
- 'ip_v6' => String,
8
- 'name' => String,
9
- 'lb_services' => Array,
10
- 'source_ip_v4' => Fog::Nullable::String,
11
- }
12
-
13
- LB_APPLICATIONS = [LB_APPLICATION]
14
-
15
- LB_SERVICE = {
16
- 'name' => String,
17
- 'port' => Integer,
18
- 'private' => Fog::Boolean,
19
- 'status_username' => String,
20
- 'status_password' => String,
21
- 'status_url' => String,
22
- 'service_type' => String,
23
- 'created' => String,
24
- 'lb_backends' => Array,
25
- 'pem_file_uploaded?' => Fog::Nullable::Boolean,
26
- }
27
-
28
- LB_SERVICES = [LB_SERVICE]
29
-
30
- LB_BACKEND = {
31
- 'id' => String,
32
- 'backend_name' => String,
33
- 'lb_machines' => Array,
34
- 'acl_name' => String,
35
- 'acl_name' => String,
36
- 'monitoring_url_hostname' => String,
37
- 'monitoring_url' => String,
38
- 'monitoring_url_hostname' => String,
39
- 'check_interval' => Integer,
40
- 'rise' => Fog::Nullable::Integer,
41
- 'order' => Fog::Nullable::Integer,
42
- 'fall' => Fog::Nullable::Integer,
43
- }
44
-
45
- LB_BACKENDS = [LB_BACKEND]
46
-
47
- LB_MACHINE = {
48
- 'port' => Integer,
49
- 'id' => String,
50
- 'ip' => String,
51
- 'maxconn' => Integer,
52
- 'hostname' => String,
53
- 'created' => String,
54
- }
55
-
56
- ADD_MACHINE_TO_LB = [
57
- { 'text' => String },
58
- { 'status' => String },
59
- ]
60
-
61
- REMOVE_MACHINE_FROM_BACKEND = 'Record Removed.'
62
- end
63
- end
64
- end
@@ -1,75 +0,0 @@
1
- require 'securerandom'
2
-
3
- Shindo.tests('Bluebox::BLB | lb_tests', ['bluebox']) do
4
- pending if Fog.mocking?
5
-
6
- tests('success') do
7
- @flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
8
- @image_id = compute_providers[:bluebox][:server_attributes][:image_id]
9
- @location_id = compute_providers[:bluebox][:server_attributes][:location_id]
10
- @password = SecureRandom.base64(18)
11
-
12
- tests("get_lb_applications").formats(Bluebox::BLB::Formats::LB_APPLICATIONS) do
13
- @lb_applications = Fog::Bluebox[:blb].get_lb_applications.body
14
- end
15
-
16
- tests("get_lb_application").formats(Bluebox::BLB::Formats::LB_APPLICATION) do
17
- Fog::Bluebox[:blb].get_lb_application(@lb_applications.first['id']).body
18
- end
19
-
20
- tests("get_lb_services").formats(Bluebox::BLB::Formats::LB_SERVICES) do
21
- @lb_services = Fog::Bluebox[:blb].get_lb_services(@lb_applications.first['id']).body
22
- end
23
-
24
- tests("get_lb_service").formats(Bluebox::BLB::Formats::LB_SERVICE) do
25
- Fog::Bluebox[:blb].get_lb_service(@lb_applications.first['id'], @lb_services.first['id']).body
26
- end
27
-
28
- tests("get_lb_backends").formats(Bluebox::BLB::Formats::LB_BACKENDS) do
29
- @lb_backends = Fog::Bluebox[:blb].get_lb_backends(@lb_services.first['id']).body
30
- end
31
-
32
- tests("get_lb_backend").formats(Bluebox::BLB::Formats::LB_BACKEND) do
33
- Fog::Bluebox[:blb].get_lb_backend(@lb_services.first['id'], @lb_backends.first['id']).body
34
- end
35
-
36
- # create block
37
- data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body
38
- @block_id = data['id']
39
- Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
40
-
41
- tests("add_machine_to_lb_application").formats(Bluebox::BLB::Formats::ADD_MACHINE_TO_LB) do
42
- Fog::Bluebox[:blb].add_machine_to_lb_application(@lb_applications.first['id'], @block_id).body
43
- end
44
-
45
- @default_backend = @lb_backends.select { |x| x['backend_name'] == 'default' }.first
46
- @id_in_backend = @default_backend['lb_machines'].last['id']
47
- @machine_opts = { 'port' => 4361, 'backup' => true };
48
- tests("update_lb_backend_machine(#{@lb_backends.first['id']}, #{@id_in_backend}, #{@machine_opts})").formats(Bluebox::BLB::Formats::LB_MACHINE) do
49
- Fog::Bluebox[:blb].update_lb_backend_machine(@lb_backends.first['id'], @id_in_backend, @machine_opts).body
50
- end
51
-
52
- tests("remove_machine_from_lb_backend(#{@default_backend['id']}, #{@id_in_backend})").formats(Bluebox::BLB::Formats::REMOVE_MACHINE_FROM_BACKEND) do
53
- Fog::Bluebox[:blb].remove_machine_from_lb_backend(@default_backend['id'], @id_in_backend).body
54
- end
55
-
56
- tests("add_machine_to_lb_backend(#{@default_backend['id']}, #{@block_id})").formats(Bluebox::BLB::Formats::ADD_MACHINE_TO_LB) do
57
- Fog::Bluebox[:blb].add_machine_to_lb_backend(@default_backend['id'], @block_id).body
58
- end
59
-
60
- Fog::Compute[:bluebox].destroy_block(@block_id).body
61
-
62
- end
63
-
64
- tests('failure') do
65
- tests('get_lb_application').raises(Fog::Compute::Bluebox::NotFound) do
66
- Fog::Bluebox[:blb].get_lb_application('00000000-0000-0000-0000-000000000000')
67
- end
68
- tests('get_lb_service').raises(Fog::Compute::Bluebox::NotFound) do
69
- Fog::Bluebox[:blb].get_lb_service('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000')
70
- end
71
- tests('get_lb_backend').raises(Fog::Compute::Bluebox::NotFound) do
72
- Fog::Bluebox[:blb].get_lb_backend('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000')
73
- end
74
- end
75
- end
@@ -1,83 +0,0 @@
1
- Shindo.tests('Fog::Compute[:bluebox] | block requests', ['bluebox']) do
2
-
3
- @block_format = {
4
- 'cpu' => Float,
5
- 'description' => String,
6
- 'hostname' => String,
7
- 'id' => String,
8
- 'ips' => [{'address' => String}],
9
- 'lb_applications' => [],
10
- 'memory' => Integer,
11
- 'product' => {'cost' => String, 'description' => String, 'id' => String},
12
- 'status' => String,
13
- 'storage' => Integer,
14
- 'location_id' => String,
15
- 'vsh_id' => String
16
- }
17
-
18
- tests('success') do
19
-
20
- @flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
21
- @image_id = compute_providers[:bluebox][:server_attributes][:image_id]
22
- @location_id = compute_providers[:bluebox][:server_attributes][:location_id]
23
- @password = compute_providers[:bluebox][:server_attributes][:password]
24
-
25
- @block_id = nil
26
-
27
- tests("create_block('#{@flavor_id}', '#{@image_id}', '#{@location_id}', {'password' => '#{@password}'})").formats(@block_format.merge('add_to_lb_application_results' => {'text' => String})) do
28
- pending if Fog.mocking?
29
- data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body
30
- @block_id = data['id']
31
- data
32
- end
33
-
34
- unless Fog.mocking?
35
- Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
36
- end
37
-
38
- tests("get_block('#{@block_id}')").formats(@block_format) do
39
- pending if Fog.mocking?
40
- Fog::Compute[:bluebox].get_block(@block_id).body
41
- end
42
-
43
- tests("get_blocks").formats([@block_format.reject {|key,value| ['product', 'template'].include?(key)}]) do
44
- pending if Fog.mocking?
45
- Fog::Compute[:bluebox].get_blocks.body
46
- end
47
-
48
- tests("reboot_block('#{@block_id}')").formats([{'status' => String}, {'text' => String}]) do
49
- pending if Fog.mocking?
50
- Fog::Compute[:bluebox].reboot_block(@block_id).body
51
- end
52
-
53
- unless Fog.mocking?
54
- Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
55
- end
56
-
57
- tests("destroy_block('#{@block_id})'").formats({'text' => String}) do
58
- pending if Fog.mocking?
59
- Fog::Compute[:bluebox].destroy_block(@block_id).body
60
- end
61
-
62
- end
63
-
64
- tests('failure') do
65
-
66
- tests("get_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
67
- pending if Fog.mocking?
68
- Fog::Compute[:bluebox].get_block('00000000-0000-0000-0000-000000000000')
69
- end
70
-
71
- tests("reboot_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
72
- pending if Fog.mocking?
73
- Fog::Compute[:bluebox].reboot_block('00000000-0000-0000-0000-000000000000')
74
- end
75
-
76
- tests("destroy_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
77
- pending if Fog.mocking?
78
- Fog::Compute[:bluebox].destroy_block('00000000-0000-0000-0000-000000000000')
79
- end
80
-
81
- end
82
-
83
- end
@@ -1,16 +0,0 @@
1
- class Bluebox
2
- module Compute
3
- module Formats
4
- PRODUCT = {
5
- 'cost' => String,
6
- 'description' => String,
7
- 'id' => String
8
- },
9
-
10
- LOCATION = {
11
- 'id' => String,
12
- 'description' => String
13
- }
14
- end
15
- end
16
- end
@@ -1,32 +0,0 @@
1
- Shindo.tests('Fog::Compute[:bluebox] | location requests', ['bluebox']) do
2
-
3
- @location_format = {
4
- 'id' => String,
5
- 'description' => String
6
- }
7
-
8
- tests('success') do
9
-
10
- @location_id = compute_providers[:bluebox][:server_attributes][:location_id]
11
-
12
- tests("get_location('#{@location_id}')").formats(@location_format) do
13
- pending if Fog.mocking?
14
- Fog::Compute[:bluebox].get_location(@location_id).body
15
- end
16
-
17
- tests("get_locations").formats([@location_format]) do
18
- pending if Fog.mocking?
19
- Fog::Compute[:bluebox].get_locations.body
20
- end
21
-
22
- end
23
-
24
- tests('failure') do
25
-
26
- tests("get_location('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
27
- pending if Fog.mocking?
28
- Fog::Compute[:bluebox].get_location('00000000-0000-0000-0000-000000000000')
29
- end
30
-
31
- end
32
- end
@@ -1,34 +0,0 @@
1
- Shindo.tests('Fog::Compute[:bluebox] | product requests', ['bluebox']) do
2
-
3
- @product_format = {
4
- 'id' => String,
5
- 'description' => String,
6
- 'cost' => String
7
- }
8
-
9
- tests('success') do
10
-
11
- @flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
12
-
13
- tests("get_product('#{@flavor_id}')").formats(@product_format) do
14
- pending if Fog.mocking?
15
- Fog::Compute[:bluebox].get_product(@flavor_id).body
16
- end
17
-
18
- tests("get_products").formats([@product_format]) do
19
- pending if Fog.mocking?
20
- Fog::Compute[:bluebox].get_products.body
21
- end
22
-
23
- end
24
-
25
- tests('failure') do
26
-
27
- tests("get_product('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
28
- pending if Fog.mocking?
29
- Fog::Compute[:bluebox].get_product('00000000-0000-0000-0000-000000000000')
30
- end
31
-
32
- end
33
-
34
- end
@@ -1,37 +0,0 @@
1
- Shindo.tests('Fog::Compute[:bluebox] | template requests', ['bluebox']) do
2
-
3
- @template_format = {
4
- 'created' => String,
5
- 'description' => String,
6
- 'id' => String,
7
- 'public' => Fog::Boolean,
8
- 'locations' => [ String ],
9
- 'status' => String
10
- }
11
-
12
- tests('success') do
13
-
14
- @template_id = compute_providers[:bluebox][:server_attributes][:image_id]
15
-
16
- tests("get_template('#{@template_id}')").formats(@template_format) do
17
- pending if Fog.mocking?
18
- Fog::Compute[:bluebox].get_template(@template_id).body
19
- end
20
-
21
- tests("get_templates").formats([@template_format]) do
22
- pending if Fog.mocking?
23
- Fog::Compute[:bluebox].get_templates.body
24
- end
25
-
26
- end
27
-
28
- tests('failure') do
29
-
30
- tests("get_template('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
31
- pending if Fog.mocking?
32
- Fog::Compute[:bluebox].get_template('00000000-0000-0000-0000-000000000000')
33
- end
34
-
35
- end
36
-
37
- end
@@ -1,258 +0,0 @@
1
- Shindo.tests('Fog::DNS[:bluebox] | DNS requests', ['bluebox', 'dns']) do
2
-
3
- @domain = ''
4
- @new_zones = []
5
- @new_records =[]
6
-
7
- tests( 'success') do
8
-
9
- test('get current zone count') do
10
- pending if Fog.mocking?
11
-
12
- @org_zone_count= 0
13
- response = Fog::DNS[:bluebox].get_zones()
14
- if response.status == 200
15
- zones = response.body['zones']
16
- @org_zone_count = zones.count
17
- end
18
-
19
- response.status == 200
20
- end
21
-
22
- test('create zone - simple') do
23
- pending if Fog.mocking?
24
-
25
- domain = generate_unique_domain
26
- response = Fog::DNS[:bluebox].create_zone(:name => domain, :ttl => 360)
27
- if response.status == 202
28
- zone_id = response.body['id']
29
- @new_zones << zone_id
30
- end
31
-
32
- response.status == 202
33
- end
34
-
35
- test('create zone - set all parameters') do
36
- pending if Fog.mocking?
37
-
38
- options = { :ttl => 60, :retry => 3600, :refresh => 1800, :minimum => 30 }
39
- @domain= generate_unique_domain
40
- response = Fog::DNS[:bluebox].create_zone(options.merge(:name => @domain))
41
- if response.status == 202
42
- @zone_id = response.body['id']
43
- @new_zones << @zone_id
44
- end
45
-
46
- response.status == 202
47
- end
48
-
49
- test("get zone #{@zone_id} - check all parameters for #{@domain}") do
50
- pending if Fog.mocking?
51
-
52
- result = false
53
-
54
- response = Fog::DNS[:bluebox].get_zone(@zone_id)
55
- if response.status == 200
56
- zone = response.body
57
- if (zone['name'] == @domain) and (zone['ttl'] == 60)
58
- result = true
59
- end
60
- end
61
-
62
- result
63
- end
64
-
65
- test('get zones - make sure total count is correct') do
66
- pending if Fog.mocking?
67
-
68
- result = false
69
-
70
- response = Fog::DNS[:bluebox].get_zones()
71
- if response.status == 200
72
- zones = response.body['zones']
73
- if (@org_zone_count+2) == zones.count
74
- result= true;
75
- end
76
- end
77
-
78
- result
79
- end
80
-
81
- test('get zones - check all parameters for a zone') do
82
- pending if Fog.mocking?
83
-
84
- result= false
85
-
86
- response = Fog::DNS[:bluebox].get_zones()
87
- if response.status == 200
88
- zones = response.body['zones']
89
- zones.each { |zone|
90
- if zone['id'] == @new_zones[1]
91
- options = { :ttl => 60, :retry => 3600, :refresh => 1800, :minimum => 30 }
92
- if (zone['name'] == @domain) and (zone['ttl'] == 60) and (zone['retry'] == 3600) and (zone['refresh'] == 1800) and (zone['minimum'] == 30)
93
- result = true;
94
- end
95
- end
96
- }
97
- if (@org_zone_count+2) == zones.count
98
- result = true;
99
- end
100
- end
101
-
102
- result
103
- end
104
-
105
- test('create record - simple A record') do
106
- pending if Fog.mocking?
107
-
108
- host= 'www.' + @domain
109
- zone_id= @new_zones[1]
110
- response = Fog::DNS[:bluebox].create_record(zone_id, 'A', host, '1.2.3.4')
111
- if response.status == 202
112
- record_id = response.body['id']
113
- @new_records << record_id
114
- end
115
-
116
- response.status == 202
117
- end
118
-
119
- test('create record - A record - all parameters set') do
120
- pending if Fog.mocking?
121
-
122
- host= 'ftp.' + @domain
123
- zone_id= @new_zones[1]
124
- response = Fog::DNS[:bluebox].create_record( zone_id, 'A', host, '1.2.3.4')
125
- if response.status == 202
126
- record_id = response.body['id']
127
- @new_records << record_id
128
- end
129
-
130
- response.status == 202
131
- end
132
-
133
- test('create record - CNAME record') do
134
- pending if Fog.mocking?
135
-
136
- zone_id= @new_zones[1]
137
- response = Fog::DNS[:bluebox].create_record( zone_id, 'CNAME', 'mail', @domain)
138
- if response.status == 202
139
- record_id = response.body['id']
140
- @new_records << record_id
141
- end
142
-
143
- response.status == 202
144
- end
145
-
146
- test('create record - NS record') do
147
- pending if Fog.mocking?
148
-
149
- ns_domain = 'ns.' + @domain
150
- zone_id= @new_zones[1]
151
- response = Fog::DNS[:bluebox].create_record( zone_id, 'NS', @domain, ns_domain)
152
- if response.status == 202
153
- record_id = response.body['id']
154
- @new_records << record_id
155
- end
156
-
157
- response.status == 202
158
- end
159
-
160
- test('create record - MX record') do
161
- pending if Fog.mocking?
162
-
163
- mail_domain = 'mail.' + @domain
164
- zone_id= @new_zones[1]
165
- response = Fog::DNS[:bluebox].create_record( zone_id, 'MX', @domain, mail_domain, :priority => 10)
166
- if response.status == 202
167
- @record_id = response.body['id']
168
- @new_records << @record_id
169
- end
170
-
171
- response.status == 202
172
- end
173
-
174
- test("get record #{@record_id} - verify all parameters") do
175
- pending if Fog.mocking?
176
-
177
- result= false
178
-
179
- response = Fog::DNS[:bluebox].get_record(@new_zones[1], @record_id)
180
- if response.status == 200
181
- mail_domain = 'mail.' + @domain + "."
182
- record = response.body
183
- if (record['type'] == 'MX') and (record['name'] == @domain) and (record['content'] == mail_domain) and (record['priority'] == '10')
184
- result= true
185
- end
186
- end
187
-
188
- result
189
- end
190
-
191
- test('get records - verify all parameters for one record') do
192
- pending if Fog.mocking?
193
-
194
- result= false
195
-
196
- response = Fog::DNS[:bluebox].get_records(@new_zones[1])
197
- if response.status == 200
198
- records = response.body['records']
199
-
200
- #find mx record
201
- records.each {|record|
202
- if record['type'] == 'MX'
203
-
204
- mail_domain = 'mail.' + @domain + "."
205
- if (record['type'] == 'MX') and (record['name'] == @domain) and (record['content'] == mail_domain) and (record['priority'] == '10')
206
- result= true
207
- break
208
- end
209
-
210
- end
211
- }
212
- end
213
-
214
- result
215
- end
216
-
217
- test("delete #{@new_records.count} records created") do
218
- pending if Fog.mocking?
219
-
220
- result= true
221
- @new_records.each { |record_id|
222
- response = Fog::DNS[:bluebox].delete_record(@new_zones[1], record_id)
223
- if response.status != 200
224
- result= false;
225
- end
226
- }
227
- result
228
- end
229
-
230
- test("delete #{@new_zones.count} zones created") do
231
- pending if Fog.mocking?
232
-
233
- result= true
234
-
235
- @new_zones.each { |zone_id|
236
- response = Fog::DNS[:bluebox].delete_zone( zone_id)
237
- if response.status != 200
238
- result= false;
239
- end
240
- }
241
-
242
- result
243
- end
244
-
245
- end
246
-
247
- tests( 'failure') do
248
-
249
- #create a zone with invalid parameters
250
- #get zonfo info with invalid zone id
251
- #delete a zone with an invalid zone id
252
-
253
- tests('#create_zone') do
254
- end
255
-
256
- end
257
-
258
- end