fog 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +3 -3
  3. data/changelog.txt +213 -0
  4. data/docs/compute/index.markdown +15 -1
  5. data/fog.gemspec +3 -3
  6. data/lib/fog.rb +1 -1
  7. data/lib/fog/aws.rb +9 -0
  8. data/lib/fog/aws/auto_scaling.rb +3 -1
  9. data/lib/fog/aws/cloud_formation.rb +2 -0
  10. data/lib/fog/aws/cloud_watch.rb +2 -0
  11. data/lib/fog/aws/compute.rb +9 -3
  12. data/lib/fog/aws/elasticache.rb +8 -1
  13. data/lib/fog/aws/elb.rb +2 -0
  14. data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +1 -2
  15. data/lib/fog/aws/models/compute/security_group.rb +1 -1
  16. data/lib/fog/aws/models/compute/server.rb +3 -1
  17. data/lib/fog/aws/models/dns/records.rb +3 -3
  18. data/lib/fog/aws/models/elb/load_balancer.rb +6 -0
  19. data/lib/fog/aws/models/storage/file.rb +2 -2
  20. data/lib/fog/aws/models/storage/files.rb +4 -4
  21. data/lib/fog/aws/parsers/compute/describe_instance_status.rb +64 -0
  22. data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
  23. data/lib/fog/aws/parsers/sqs/receive_message.rb +1 -1
  24. data/lib/fog/aws/parsers/sts/get_session_token.rb +31 -0
  25. data/lib/fog/aws/rds.rb +36 -1
  26. data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
  27. data/lib/fog/aws/requests/compute/describe_instance_status.rb +36 -0
  28. data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
  29. data/lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb +27 -0
  30. data/lib/fog/aws/requests/rds/create_db_instance.rb +64 -1
  31. data/lib/fog/aws/requests/rds/delete_db_instance.rb +19 -3
  32. data/lib/fog/aws/requests/rds/describe_db_instances.rb +40 -1
  33. data/lib/fog/aws/requests/rds/describe_db_reserved_instances.rb +1 -1
  34. data/lib/fog/aws/requests/rds/modify_db_instance.rb +24 -1
  35. data/lib/fog/aws/requests/rds/reboot_db_instance.rb +17 -1
  36. data/lib/fog/aws/requests/storage/{hash_to_acl.rb → acl_utils.rb} +8 -0
  37. data/lib/fog/aws/requests/storage/copy_object.rb +8 -0
  38. data/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
  39. data/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
  40. data/lib/fog/aws/requests/storage/get_object_http_url.rb +4 -3
  41. data/lib/fog/aws/requests/storage/get_object_https_url.rb +4 -3
  42. data/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
  43. data/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
  44. data/lib/fog/aws/requests/sts/get_federation_token.rb +20 -0
  45. data/lib/fog/aws/requests/sts/get_session_token.rb +18 -0
  46. data/lib/fog/aws/simpledb.rb +5 -1
  47. data/lib/fog/aws/sns.rb +2 -0
  48. data/lib/fog/aws/sqs.rb +5 -1
  49. data/lib/fog/aws/storage.rb +6 -0
  50. data/lib/fog/aws/sts.rb +137 -0
  51. data/lib/fog/bin.rb +1 -0
  52. data/lib/fog/bin/aws.rb +2 -0
  53. data/lib/fog/bin/clodo.rb +31 -0
  54. data/lib/fog/brightbox/compute.rb +7 -0
  55. data/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
  56. data/lib/fog/brightbox/models/compute/firewall_policies.rb +29 -0
  57. data/lib/fog/brightbox/models/compute/firewall_policy.rb +65 -0
  58. data/lib/fog/brightbox/models/compute/firewall_rule.rb +54 -0
  59. data/lib/fog/brightbox/models/compute/firewall_rules.rb +24 -0
  60. data/lib/fog/brightbox/models/compute/image.rb +2 -0
  61. data/lib/fog/brightbox/models/compute/server.rb +41 -6
  62. data/lib/fog/brightbox/models/compute/server_group.rb +56 -17
  63. data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +14 -0
  64. data/lib/fog/clodo.rb +34 -0
  65. data/lib/fog/clodo/compute.rb +152 -0
  66. data/lib/fog/clodo/models/compute/image.rb +31 -0
  67. data/lib/fog/clodo/models/compute/images.rb +28 -0
  68. data/lib/fog/clodo/models/compute/server.rb +163 -0
  69. data/lib/fog/clodo/models/compute/servers.rb +36 -0
  70. data/lib/fog/clodo/requests/compute/add_ip_address.rb +49 -0
  71. data/lib/fog/clodo/requests/compute/create_server.rb +112 -0
  72. data/lib/fog/clodo/requests/compute/delete_ip_address.rb +47 -0
  73. data/lib/fog/clodo/requests/compute/delete_server.rb +44 -0
  74. data/lib/fog/clodo/requests/compute/get_image_details.rb +20 -0
  75. data/lib/fog/clodo/requests/compute/get_server_details.rb +49 -0
  76. data/lib/fog/clodo/requests/compute/list_images.rb +48 -0
  77. data/lib/fog/clodo/requests/compute/list_images_detail.rb +61 -0
  78. data/lib/fog/clodo/requests/compute/list_servers.rb +50 -0
  79. data/lib/fog/clodo/requests/compute/list_servers_detail.rb +51 -0
  80. data/lib/fog/clodo/requests/compute/move_ip_address.rb +34 -0
  81. data/lib/fog/clodo/requests/compute/reboot_server.rb +19 -0
  82. data/lib/fog/clodo/requests/compute/rebuild_server.rb +21 -0
  83. data/lib/fog/clodo/requests/compute/server_action.rb +25 -0
  84. data/lib/fog/clodo/requests/compute/start_server.rb +19 -0
  85. data/lib/fog/clodo/requests/compute/stop_server.rb +19 -0
  86. data/lib/fog/compute.rb +3 -0
  87. data/lib/fog/core/credentials.rb +3 -3
  88. data/lib/fog/core/errors.rb +2 -0
  89. data/lib/fog/core/wait_for.rb +1 -1
  90. data/lib/fog/dnsmadeeasy/dns.rb +1 -1
  91. data/lib/fog/libvirt/compute.rb +2 -0
  92. data/lib/fog/libvirt/models/compute/nodes.rb +1 -3
  93. data/lib/fog/libvirt/models/compute/server.rb +8 -1
  94. data/lib/fog/providers.rb +1 -0
  95. data/lib/fog/rackspace/dns.rb +10 -2
  96. data/lib/fog/rackspace/load_balancers.rb +3 -0
  97. data/lib/fog/rackspace/models/compute/server.rb +2 -2
  98. data/lib/fog/rackspace/models/dns/callback.rb +3 -1
  99. data/lib/fog/rackspace/models/dns/record.rb +4 -0
  100. data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +18 -8
  101. data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +1 -2
  102. data/lib/fog/rackspace/requests/load_balancers/get_error_page.rb +15 -0
  103. data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +8 -2
  104. data/lib/fog/rackspace/requests/load_balancers/remove_error_page.rb +15 -0
  105. data/lib/fog/rackspace/requests/load_balancers/set_error_page.rb +21 -0
  106. data/lib/fog/vcloud/compute.rb +7 -1
  107. data/lib/fog/vcloud/models/compute/catalogs.rb +4 -5
  108. data/lib/fog/vcloud/models/compute/helpers/status.rb +37 -0
  109. data/lib/fog/vcloud/models/compute/network.rb +13 -49
  110. data/lib/fog/vcloud/models/compute/networks.rb +12 -3
  111. data/lib/fog/vcloud/models/compute/organization.rb +44 -0
  112. data/lib/fog/vcloud/models/compute/organizations.rb +29 -0
  113. data/lib/fog/vcloud/models/compute/server.rb +35 -56
  114. data/lib/fog/vcloud/models/compute/servers.rb +11 -13
  115. data/lib/fog/vcloud/models/compute/vapp.rb +41 -0
  116. data/lib/fog/vcloud/models/compute/vapps.rb +32 -0
  117. data/lib/fog/vcloud/models/compute/vdc.rb +11 -26
  118. data/lib/fog/vcloud/models/compute/vdcs.rb +6 -8
  119. data/lib/fog/vcloud/requests/compute/get_server.rb +10 -0
  120. data/lib/fog/vsphere/compute.rb +1 -0
  121. data/lib/fog/vsphere/models/compute/server.rb +18 -0
  122. data/lib/fog/vsphere/models/compute/servers.rb +8 -2
  123. data/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
  124. data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +132 -91
  125. data/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
  126. data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +58 -0
  127. data/tests/aws/models/elb/model_tests.rb +5 -0
  128. data/tests/aws/requests/compute/instance_tests.rb +23 -0
  129. data/tests/aws/requests/compute/security_group_tests.rb +1 -0
  130. data/tests/aws/requests/elb/listener_tests.rb +4 -0
  131. data/tests/aws/requests/storage/{hash_to_acl_tests.rb → acl_utils_tests.rb} +38 -2
  132. data/tests/aws/requests/storage/bucket_tests.rb +0 -3
  133. data/tests/aws/requests/storage/object_tests.rb +2 -4
  134. data/tests/aws/requests/sts/get_federation_token_tests.rb +21 -0
  135. data/tests/aws/requests/sts/session_token_tests.rb +16 -0
  136. data/tests/brightbox/requests/compute/account_tests.rb +11 -6
  137. data/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
  138. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +32 -17
  139. data/tests/brightbox/requests/compute/helper.rb +29 -3
  140. data/tests/brightbox/requests/compute/image_tests.rb +17 -14
  141. data/tests/brightbox/requests/compute/interface_tests.rb +3 -2
  142. data/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
  143. data/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
  144. data/tests/brightbox/requests/compute/server_tests.rb +41 -22
  145. data/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
  146. data/tests/brightbox/requests/compute/user_tests.rb +11 -16
  147. data/tests/brightbox/requests/compute/zone_tests.rb +7 -6
  148. data/tests/clodo/requests/compute/image_tests.rb +36 -0
  149. data/tests/clodo/requests/compute/server_tests.rb +152 -0
  150. data/tests/compute/helper.rb +1 -1
  151. data/tests/core/credential_tests.rb +2 -2
  152. data/tests/glesys/requests/compute/helper.rb +91 -66
  153. data/tests/glesys/requests/compute/ip_tests.rb +1 -1
  154. data/tests/glesys/requests/compute/server_tests.rb +5 -5
  155. data/tests/helpers/mock_helper.rb +2 -0
  156. data/tests/rackspace/models/dns/zone_tests.rb +14 -0
  157. data/tests/rackspace/models/{access_list_tests.rb → load_balancers/access_list_tests.rb} +0 -0
  158. data/tests/rackspace/models/{access_lists_tests.rb → load_balancers/access_lists_tests.rb} +0 -0
  159. data/tests/rackspace/models/{load_balancer_tests.rb → load_balancers/load_balancer_tests.rb} +25 -0
  160. data/tests/rackspace/models/{load_balancers_tests.rb → load_balancers/load_balancers_tests.rb} +0 -0
  161. data/tests/rackspace/models/{node_tests.rb → load_balancers/node_tests.rb} +0 -0
  162. data/tests/rackspace/models/{nodes_tests.rb → load_balancers/nodes_tests.rb} +0 -0
  163. data/tests/rackspace/models/{virtual_ip_tests.rb → load_balancers/virtual_ip_tests.rb} +0 -0
  164. data/tests/rackspace/models/{virtual_ips_tests.rb → load_balancers/virtual_ips_tests.rb} +0 -0
  165. data/tests/rackspace/requests/dns/dns_tests.rb +4 -2
  166. data/tests/rackspace/requests/load_balancers/error_page_tests.rb +31 -0
  167. data/tests/rackspace/requests/load_balancers/helper.rb +27 -11
  168. data/tests/rackspace/requests/load_balancers/load_balancer_tests.rb +4 -1
  169. data/tests/rackspace/requests/load_balancers/node_tests.rb +24 -25
  170. data/tests/slicehost/requests/compute/slice_tests.rb +2 -2
  171. data/tests/storm_on_demand/requests/compute/server_tests.rb +3 -3
  172. data/tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2 +110 -0
  173. data/tests/vcloud/data/api_+_v1.0_+_login +5 -0
  174. data/tests/vcloud/data/api_+_v1.0_+_network_+_1 +44 -0
  175. data/tests/vcloud/data/api_+_v1.0_+_network_+_2 +31 -0
  176. data/tests/vcloud/data/api_+_v1.0_+_org_+_1 +17 -0
  177. data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1 +369 -0
  178. data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1 +139 -0
  179. data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2 +155 -0
  180. data/tests/vcloud/data/api_+_v1.0_+_vdc_+_1 +61 -0
  181. data/tests/vcloud/models/compute/conn_helper.rb +20 -0
  182. data/tests/vcloud/models/compute/network_tests.rb +65 -0
  183. data/tests/vcloud/models/compute/networks_tests.rb +42 -0
  184. data/tests/vcloud/models/compute/organization_tests.rb +13 -0
  185. data/tests/vcloud/models/compute/organizations_tests.rb +14 -0
  186. data/tests/vcloud/models/compute/server_tests.rb +136 -0
  187. data/tests/vcloud/models/compute/servers_tests.rb +10 -89
  188. data/tests/vcloud/models/compute/vapp_tests.rb +27 -0
  189. data/tests/vcloud/models/compute/vapps_tests.rb +17 -0
  190. data/tests/vcloud/models/compute/vdc_tests.rb +42 -0
  191. data/tests/vcloud/models/compute/vdcs_tests.rb +17 -0
  192. data/tests/vsphere/requests/compute/vm_clone_tests.rb +2 -6
  193. metadata +151 -55
@@ -0,0 +1,50 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+
6
+ # List all servers (IDs and names only)
7
+ #
8
+ # ==== Returns
9
+ # * response<~Excon::Response>:
10
+ # * body<~Hash>:
11
+ # * 'servers'<~Array>:
12
+ # * 'id'<~String> - Id of server
13
+ # * 'name'<~String> - Name of server
14
+ # * 'addresses'<~Hash>:
15
+ # * 'public'<~Array>:
16
+ # * 'dosprotect'<~Bool> - DDoS protection enabled
17
+ # * 'primary_ip'<~Bool> - Is a primary IP-address
18
+ # * 'isp'<~Bool> - ISPManager license enabled
19
+ # * 'ip'<~String> - IP-address
20
+ # * 'imageId'<~String> - ID of OS image installed
21
+ # * 'type'<~String> - Type (ScaleServer or Virtual Server)
22
+ # * 'status'<~String> - Server's status
23
+ def list_servers
24
+ request(
25
+ :expects => [200, 203],
26
+ :method => 'GET',
27
+ :path => 'servers'
28
+ )
29
+ end
30
+
31
+ end
32
+
33
+ class Mock
34
+
35
+ def list_servers
36
+ response = Excon::Response.new
37
+ data = list_servers_detail.body['servers']
38
+ servers = []
39
+ for server in data
40
+ servers << server.reject { |key, value| !['id', 'name', 'addresses', 'imageId', 'type', 'status', 'state'].include?(key) }
41
+ end
42
+ response.status = [200, 203][rand(1)]
43
+ response.body = { 'servers' => servers }
44
+ response
45
+ end
46
+
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,51 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+
6
+ # List all servers details
7
+ #
8
+ # ==== Returns
9
+ # * response<~Excon::Response>:
10
+ # * body<~Hash>:
11
+ # * 'servers'<~Array>:
12
+ # * 'id'<~Integer> - Id of server
13
+ # * 'name<~String> - Name of server
14
+ # * 'imageId'<~Integer> - Id of image used to boot server
15
+ # * 'status'<~String> - Current server status
16
+ # * 'addresses'<~Hash>:
17
+ # * 'public'<~Array> - public address strings
18
+ def list_servers_detail
19
+ request(
20
+ :expects => [200, 203],
21
+ :method => 'GET',
22
+ :path => 'servers/detail'
23
+ )
24
+ end
25
+
26
+ end
27
+
28
+ class Mock
29
+
30
+ def list_servers_detail
31
+ response = Excon::Response.new
32
+
33
+ servers = self.data[:servers].values
34
+ for server in servers
35
+ case server['status']
36
+ when 'is_install'
37
+ if Time.now - self.data[:last_modified][:servers][server['id']] > Fog::Mock.delay * 2
38
+ server['status'] = 'is_running'
39
+ end
40
+ end
41
+ end
42
+
43
+ response.status = [200, 203][rand(1)]
44
+ response.body = { 'servers' => servers }
45
+ response
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,34 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+
6
+ # Move IP-address to specified server.
7
+ # ==== Paramaters
8
+ # * server_id<~Integer> - Id of server to move IP to
9
+ # * ip<~String> - IP-address to move
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>
13
+ #
14
+
15
+ def move_ip_address(server_id, ip)
16
+ request(
17
+ :expects => [204],
18
+ :method => 'GET',
19
+ :path => "servers/#{server_id}/ips/moveip",
20
+ :body => MultiJson.encode({'ip'=>"#{ip}"})
21
+ )
22
+ end
23
+ end
24
+
25
+ class Mock
26
+ def move_ip_address(server_id, ip)
27
+ response = Excon::Response.new
28
+ response.status = [204]
29
+ response
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+ def reboot_server(id, type)
6
+ body = {'reboot' => {}}
7
+ server_action(id, body)
8
+ end
9
+ end
10
+
11
+ class Mock
12
+ def reboot_server(id, type)
13
+ body = {'reboot' => {}}
14
+ server_action(id, body)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+ def rebuild_server(id, image_id, vps_isp = nil)
6
+ body = {'rebuild' => {'imageId' => image_id}}
7
+ body['rebuild']['vps_isp'] = vps_isp if vps_isp
8
+ server_action(id, body)
9
+ end
10
+ end
11
+
12
+ class Mock
13
+ def rebuild_server(id, image_id, vps_isp = nil)
14
+ body = {'rebuild' => {'imageId' => image_id}}
15
+ body['rebuild']['vps_isp'] = vps_isp if vps_isp
16
+ server_action(id, body)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+ def server_action(id, action)
6
+ request(
7
+ :body => MultiJson.encode(action),
8
+ :expects => [204],
9
+ :method => 'POST',
10
+ :path => "servers/#{id}/action")
11
+ end
12
+ end
13
+ class Mock
14
+ def server_action(id, action)
15
+
16
+ raise Excon::Errors::BadRequest.new("Invalid server id #{id}.") unless id > 0
17
+
18
+ response = Excon::Response.new
19
+ response.status = 204
20
+ response
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+ def start_server(id)
6
+ body = {'start' => {}}
7
+ server_action(id, body)
8
+ end
9
+ end
10
+
11
+ class Mock
12
+ def start_server(id)
13
+ body = {'start' => {}}
14
+ server_action(id, body)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Compute
3
+ class Clodo
4
+ class Real
5
+ def stop_server(id)
6
+ body = {'stop' => {}}
7
+ server_action(id, body)
8
+ end
9
+ end
10
+
11
+ class Mock
12
+ def stop_server(id)
13
+ body = {'stop' => {}}
14
+ server_action(id, body)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/fog/compute.rb CHANGED
@@ -17,6 +17,9 @@ module Fog
17
17
  when :brightbox
18
18
  require 'fog/brightbox/compute'
19
19
  Fog::Compute::Brightbox.new(attributes)
20
+ when :clodo
21
+ require 'fog/clodo/compute'
22
+ Fog::Compute::Clodo.new(attributes)
20
23
  when :ecloud
21
24
  require 'fog/ecloud/compute'
22
25
  Fog::Compute::Ecloud.new(attributes)
@@ -5,15 +5,15 @@ module Fog
5
5
 
6
6
  # Assign a new credential to use from configuration file
7
7
  # @param [String, Symbol] new_credential name of new credential to use
8
- # @ return [String, Symbol] name of the new credential
8
+ # @ return [Symbol] name of the new credential
9
9
  def self.credential=(new_credential)
10
10
  @credentials = nil
11
- @credential = new_credential
11
+ @credential = new_credential && new_credential.to_sym
12
12
  end
13
13
 
14
14
  # @return [String, Symbol] The credential to use in Fog
15
15
  def self.credential
16
- @credential ||= ENV["FOG_CREDENTIAL"] || :default
16
+ @credential ||= ( ENV["FOG_CREDENTIAL"] && ENV["FOG_CREDENTIAL"].to_sym ) || :default
17
17
  end
18
18
 
19
19
  # @return [String] The path for configuration_file
@@ -38,6 +38,8 @@ An alternate file may be used by placing its path in the FOG_RC environment vari
38
38
  :bluebox_customer_id:
39
39
  :brightbox_client_id:
40
40
  :brightbox_secret:
41
+ :clodo_api_key:
42
+ :clodo_username:
41
43
  :go_grid_api_key:
42
44
  :go_grid_shared_secret:
43
45
  :google_storage_access_key_id:
@@ -4,7 +4,7 @@ module Fog
4
4
  duration = 0
5
5
  start = Time.now
6
6
  until yield || duration > timeout
7
- sleep(interval)
7
+ sleep(interval.to_f)
8
8
  duration = Time.now - start
9
9
  end
10
10
  if duration > timeout
@@ -68,7 +68,7 @@ module Fog
68
68
  # :dnsmadeeasy_secret_key in order to create a connection
69
69
  #
70
70
  # ==== Examples
71
- # dns = Fog::DNSMadeEasy::DNS.new(
71
+ # dns = Fog::DNS::DNSMadeEasy.new(
72
72
  # :dnsmadeeasy_api_key => your_dnsmadeeasy_api_key,
73
73
  # :dnsmadeeasy_secret_key => your_dnsmadeeasy_secret_key
74
74
  # )
@@ -8,6 +8,8 @@ module Fog
8
8
  class Libvirt < Fog::Service
9
9
 
10
10
  requires :libvirt_uri
11
+ recognizes :libvirt_username, :libvirt_password
12
+ recognizes :libvirt_ip_command
11
13
 
12
14
  model_path 'fog/libvirt/models/compute'
13
15
  model :server
@@ -26,10 +26,8 @@ module Fog
26
26
  node_info[param]=nil
27
27
  end
28
28
  end
29
- node_info[:uri]=connection.connection.uri
29
+ node_info[:uri]=connection.uri
30
30
  data << { :raw => node_info }
31
- require 'pp'
32
- pp node_info
33
31
  load(data)
34
32
  end
35
33
 
@@ -206,6 +206,13 @@ module Fog
206
206
  @raw.destroy
207
207
  end
208
208
  @raw.undefine
209
+ if options[:destroy_volumes]
210
+ disk_path = document("domain/devices/disk/source", "file")
211
+ # volumes.all filters do not handle nil keys well
212
+ (connection.volumes.all(:path => disk_path) rescue []).each do |vol|
213
+ vol.destroy
214
+ end
215
+ end
209
216
  end
210
217
 
211
218
  def reboot
@@ -282,7 +289,7 @@ module Fog
282
289
  ip_command_global=@connection.ip_command.nil? ? 'grep $mac /var/log/arpwatch.log|sed -e "s/new station//"|sed -e "s/changed ethernet address//g" |sed -e "s/reused old ethernet //" |tail -1 |cut -d ":" -f 4-| cut -d " " -f 3' : @connection.ip_command
283
290
  ip_command_local=options[:ip_command].nil? ? ip_command_global : options[:ip_command]
284
291
 
285
- ip_command="mac=#{mac}; "+ip_command_local
292
+ ip_command="mac=#{mac}; server_name=#{name}; "+ip_command_local
286
293
 
287
294
  ip_address=nil
288
295
 
data/lib/fog/providers.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'fog/aws'
2
2
  require 'fog/bluebox'
3
3
  require 'fog/brightbox'
4
+ require 'fog/clodo'
4
5
  require 'fog/dnsimple'
5
6
  require 'fog/dnsmadeeasy'
6
7
  require 'fog/dynect'
@@ -5,12 +5,20 @@ module Fog
5
5
  module DNS
6
6
  class Rackspace < Fog::Service
7
7
 
8
+ class CallbackError < Fog::Errors::Error
9
+ attr_reader :response, :message, :details
10
+ def initialize(response)
11
+ @response = response
12
+ @message = response.body['error']['message']
13
+ @details = response.body['error']['details']
14
+ end
15
+ end
16
+
8
17
  US_ENDPOINT = 'https://dns.api.rackspacecloud.com/v1.0'
9
18
  UK_ENDPOINT = 'https://lon.dns.api.rackspacecloud.com/v1.0'
10
19
 
11
20
  requires :rackspace_api_key, :rackspace_username
12
- recognizes :rackspace_auth_url
13
- recognizes :rackspace_auth_token
21
+ recognizes :rackspace_auth_url, :rackspace_auth_token, :rackspace_dns_endpoint
14
22
 
15
23
  model_path 'fog/rackspace/models/dns'
16
24
  model :record
@@ -62,6 +62,9 @@ module Fog
62
62
  request :remove_monitor
63
63
  request :get_usage
64
64
  request :get_load_balancer_usage
65
+ request :get_error_page
66
+ request :set_error_page
67
+ request :remove_error_page
65
68
 
66
69
  module Shared
67
70
 
@@ -9,9 +9,9 @@ module Fog
9
9
  identity :id
10
10
 
11
11
  attribute :addresses
12
- attribute :flavor_id, :aliases => 'flavorId'
12
+ attribute :flavor_id, :aliases => 'flavorId', :type => :integer
13
13
  attribute :host_id, :aliases => 'hostId'
14
- attribute :image_id, :aliases => 'imageId'
14
+ attribute :image_id, :aliases => 'imageId', :type => :integer
15
15
  attribute :metadata
16
16
  attribute :name
17
17
  attribute :personality
@@ -11,8 +11,10 @@ module Fog
11
11
  response = nil
12
12
  Fog.wait_for(timeout, interval) do
13
13
  response = connection.callback job_id
14
- if response.body['status'] != 'RUNNING'
14
+ if response.body['status'] == 'COMPLETED'
15
15
  true
16
+ elsif response.body['status'] == 'ERROR'
17
+ raise Fog::DNS::Rackspace::CallbackError.new(response)
16
18
  elsif retries == 0
17
19
  raise Fog::Errors::Error.new("Wait on job #{job_id} took too long")
18
20
  else
@@ -50,6 +50,10 @@ module Fog
50
50
  :data => value
51
51
  }
52
52
 
53
+ if priority
54
+ options[:priority] = priority
55
+ end
56
+
53
57
  response = wait_for_job connection.add_records(@zone.identity, [options]).body['jobId']
54
58
  merge_attributes(response.body['response']['records'].select {|record| record['name'] == self.name && record['type'] == self.type && record['data'] == self.value}.first)
55
59
  true
@@ -70,10 +70,6 @@ module Fog
70
70
  virtual_ips.load(new_virtual_ips)
71
71
  end
72
72
 
73
- def connection_logging
74
- attributes[:connection_logging]
75
- end
76
-
77
73
  def enable_connection_logging
78
74
  requires :identity
79
75
  connection.set_connection_logging identity, true
@@ -94,7 +90,7 @@ module Fog
94
90
 
95
91
  def enable_health_monitor(type, delay, timeout, attempsBeforeDeactivation, options = {})
96
92
  requires :identity
97
- connection.set_monitor(identity, type, delay, timeout, attempsBeforeDeactivation, options = {})
93
+ connection.set_monitor(identity, type, delay, timeout, attempsBeforeDeactivation, options)
98
94
  true
99
95
  end
100
96
 
@@ -164,6 +160,21 @@ module Fog
164
160
  connection.get_load_balancer_usage(identity, options).body
165
161
  end
166
162
 
163
+ def error_page
164
+ requires :identity
165
+ connection.get_error_page(identity).body['errorpage']['content']
166
+ end
167
+
168
+ def error_page=(content)
169
+ requires :identity
170
+ connection.set_error_page identity, content
171
+ end
172
+
173
+ def reset_error_page
174
+ requires :identity
175
+ connection.remove_error_page identity
176
+ end
177
+
167
178
  private
168
179
  def create
169
180
  requires :name, :protocol, :port, :virtual_ips, :nodes
@@ -200,16 +211,15 @@ module Fog
200
211
  def connection_logging=(new_value)
201
212
  if !new_value.nil? and new_value.is_a?(Hash)
202
213
  attributes[:connection_logging] = case new_value['enabled']
203
- when 'true'
214
+ when true,'true'
204
215
  true
205
- when 'false'
216
+ when false,'false'
206
217
  false
207
218
  end
208
219
  else
209
220
  attributes[:connection_logging] = new_value
210
221
  end
211
222
  end
212
-
213
223
  end
214
224
  end
215
225
  end