fog 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +3 -3
- data/changelog.txt +213 -0
- data/docs/compute/index.markdown +15 -1
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +9 -0
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +2 -0
- data/lib/fog/aws/cloud_watch.rb +2 -0
- data/lib/fog/aws/compute.rb +9 -3
- data/lib/fog/aws/elasticache.rb +8 -1
- data/lib/fog/aws/elb.rb +2 -0
- data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +1 -2
- data/lib/fog/aws/models/compute/security_group.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +3 -1
- data/lib/fog/aws/models/dns/records.rb +3 -3
- data/lib/fog/aws/models/elb/load_balancer.rb +6 -0
- data/lib/fog/aws/models/storage/file.rb +2 -2
- data/lib/fog/aws/models/storage/files.rb +4 -4
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +64 -0
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
- data/lib/fog/aws/parsers/sqs/receive_message.rb +1 -1
- data/lib/fog/aws/parsers/sts/get_session_token.rb +31 -0
- data/lib/fog/aws/rds.rb +36 -1
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
- data/lib/fog/aws/requests/compute/describe_instance_status.rb +36 -0
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
- data/lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb +27 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +64 -1
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +19 -3
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +40 -1
- data/lib/fog/aws/requests/rds/describe_db_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +24 -1
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +17 -1
- data/lib/fog/aws/requests/storage/{hash_to_acl.rb → acl_utils.rb} +8 -0
- data/lib/fog/aws/requests/storage/copy_object.rb +8 -0
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_http_url.rb +4 -3
- data/lib/fog/aws/requests/storage/get_object_https_url.rb +4 -3
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
- data/lib/fog/aws/requests/sts/get_federation_token.rb +20 -0
- data/lib/fog/aws/requests/sts/get_session_token.rb +18 -0
- data/lib/fog/aws/simpledb.rb +5 -1
- data/lib/fog/aws/sns.rb +2 -0
- data/lib/fog/aws/sqs.rb +5 -1
- data/lib/fog/aws/storage.rb +6 -0
- data/lib/fog/aws/sts.rb +137 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/aws.rb +2 -0
- data/lib/fog/bin/clodo.rb +31 -0
- data/lib/fog/brightbox/compute.rb +7 -0
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
- data/lib/fog/brightbox/models/compute/firewall_policies.rb +29 -0
- data/lib/fog/brightbox/models/compute/firewall_policy.rb +65 -0
- data/lib/fog/brightbox/models/compute/firewall_rule.rb +54 -0
- data/lib/fog/brightbox/models/compute/firewall_rules.rb +24 -0
- data/lib/fog/brightbox/models/compute/image.rb +2 -0
- data/lib/fog/brightbox/models/compute/server.rb +41 -6
- data/lib/fog/brightbox/models/compute/server_group.rb +56 -17
- data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +14 -0
- data/lib/fog/clodo.rb +34 -0
- data/lib/fog/clodo/compute.rb +152 -0
- data/lib/fog/clodo/models/compute/image.rb +31 -0
- data/lib/fog/clodo/models/compute/images.rb +28 -0
- data/lib/fog/clodo/models/compute/server.rb +163 -0
- data/lib/fog/clodo/models/compute/servers.rb +36 -0
- data/lib/fog/clodo/requests/compute/add_ip_address.rb +49 -0
- data/lib/fog/clodo/requests/compute/create_server.rb +112 -0
- data/lib/fog/clodo/requests/compute/delete_ip_address.rb +47 -0
- data/lib/fog/clodo/requests/compute/delete_server.rb +44 -0
- data/lib/fog/clodo/requests/compute/get_image_details.rb +20 -0
- data/lib/fog/clodo/requests/compute/get_server_details.rb +49 -0
- data/lib/fog/clodo/requests/compute/list_images.rb +48 -0
- data/lib/fog/clodo/requests/compute/list_images_detail.rb +61 -0
- data/lib/fog/clodo/requests/compute/list_servers.rb +50 -0
- data/lib/fog/clodo/requests/compute/list_servers_detail.rb +51 -0
- data/lib/fog/clodo/requests/compute/move_ip_address.rb +34 -0
- data/lib/fog/clodo/requests/compute/reboot_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/rebuild_server.rb +21 -0
- data/lib/fog/clodo/requests/compute/server_action.rb +25 -0
- data/lib/fog/clodo/requests/compute/start_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/stop_server.rb +19 -0
- data/lib/fog/compute.rb +3 -0
- data/lib/fog/core/credentials.rb +3 -3
- data/lib/fog/core/errors.rb +2 -0
- data/lib/fog/core/wait_for.rb +1 -1
- data/lib/fog/dnsmadeeasy/dns.rb +1 -1
- data/lib/fog/libvirt/compute.rb +2 -0
- data/lib/fog/libvirt/models/compute/nodes.rb +1 -3
- data/lib/fog/libvirt/models/compute/server.rb +8 -1
- data/lib/fog/providers.rb +1 -0
- data/lib/fog/rackspace/dns.rb +10 -2
- data/lib/fog/rackspace/load_balancers.rb +3 -0
- data/lib/fog/rackspace/models/compute/server.rb +2 -2
- data/lib/fog/rackspace/models/dns/callback.rb +3 -1
- data/lib/fog/rackspace/models/dns/record.rb +4 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +18 -8
- data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +1 -2
- data/lib/fog/rackspace/requests/load_balancers/get_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +8 -2
- data/lib/fog/rackspace/requests/load_balancers/remove_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_error_page.rb +21 -0
- data/lib/fog/vcloud/compute.rb +7 -1
- data/lib/fog/vcloud/models/compute/catalogs.rb +4 -5
- data/lib/fog/vcloud/models/compute/helpers/status.rb +37 -0
- data/lib/fog/vcloud/models/compute/network.rb +13 -49
- data/lib/fog/vcloud/models/compute/networks.rb +12 -3
- data/lib/fog/vcloud/models/compute/organization.rb +44 -0
- data/lib/fog/vcloud/models/compute/organizations.rb +29 -0
- data/lib/fog/vcloud/models/compute/server.rb +35 -56
- data/lib/fog/vcloud/models/compute/servers.rb +11 -13
- data/lib/fog/vcloud/models/compute/vapp.rb +41 -0
- data/lib/fog/vcloud/models/compute/vapps.rb +32 -0
- data/lib/fog/vcloud/models/compute/vdc.rb +11 -26
- data/lib/fog/vcloud/models/compute/vdcs.rb +6 -8
- data/lib/fog/vcloud/requests/compute/get_server.rb +10 -0
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/models/compute/server.rb +18 -0
- data/lib/fog/vsphere/models/compute/servers.rb +8 -2
- data/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +132 -91
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
- data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +58 -0
- data/tests/aws/models/elb/model_tests.rb +5 -0
- data/tests/aws/requests/compute/instance_tests.rb +23 -0
- data/tests/aws/requests/compute/security_group_tests.rb +1 -0
- data/tests/aws/requests/elb/listener_tests.rb +4 -0
- data/tests/aws/requests/storage/{hash_to_acl_tests.rb → acl_utils_tests.rb} +38 -2
- data/tests/aws/requests/storage/bucket_tests.rb +0 -3
- data/tests/aws/requests/storage/object_tests.rb +2 -4
- data/tests/aws/requests/sts/get_federation_token_tests.rb +21 -0
- data/tests/aws/requests/sts/session_token_tests.rb +16 -0
- data/tests/brightbox/requests/compute/account_tests.rb +11 -6
- data/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +32 -17
- data/tests/brightbox/requests/compute/helper.rb +29 -3
- data/tests/brightbox/requests/compute/image_tests.rb +17 -14
- data/tests/brightbox/requests/compute/interface_tests.rb +3 -2
- data/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
- data/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
- data/tests/brightbox/requests/compute/server_tests.rb +41 -22
- data/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
- data/tests/brightbox/requests/compute/user_tests.rb +11 -16
- data/tests/brightbox/requests/compute/zone_tests.rb +7 -6
- data/tests/clodo/requests/compute/image_tests.rb +36 -0
- data/tests/clodo/requests/compute/server_tests.rb +152 -0
- data/tests/compute/helper.rb +1 -1
- data/tests/core/credential_tests.rb +2 -2
- data/tests/glesys/requests/compute/helper.rb +91 -66
- data/tests/glesys/requests/compute/ip_tests.rb +1 -1
- data/tests/glesys/requests/compute/server_tests.rb +5 -5
- data/tests/helpers/mock_helper.rb +2 -0
- data/tests/rackspace/models/dns/zone_tests.rb +14 -0
- data/tests/rackspace/models/{access_list_tests.rb → load_balancers/access_list_tests.rb} +0 -0
- data/tests/rackspace/models/{access_lists_tests.rb → load_balancers/access_lists_tests.rb} +0 -0
- data/tests/rackspace/models/{load_balancer_tests.rb → load_balancers/load_balancer_tests.rb} +25 -0
- data/tests/rackspace/models/{load_balancers_tests.rb → load_balancers/load_balancers_tests.rb} +0 -0
- data/tests/rackspace/models/{node_tests.rb → load_balancers/node_tests.rb} +0 -0
- data/tests/rackspace/models/{nodes_tests.rb → load_balancers/nodes_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ip_tests.rb → load_balancers/virtual_ip_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ips_tests.rb → load_balancers/virtual_ips_tests.rb} +0 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +4 -2
- data/tests/rackspace/requests/load_balancers/error_page_tests.rb +31 -0
- data/tests/rackspace/requests/load_balancers/helper.rb +27 -11
- data/tests/rackspace/requests/load_balancers/load_balancer_tests.rb +4 -1
- data/tests/rackspace/requests/load_balancers/node_tests.rb +24 -25
- data/tests/slicehost/requests/compute/slice_tests.rb +2 -2
- data/tests/storm_on_demand/requests/compute/server_tests.rb +3 -3
- data/tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2 +110 -0
- data/tests/vcloud/data/api_+_v1.0_+_login +5 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_1 +44 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_2 +31 -0
- data/tests/vcloud/data/api_+_v1.0_+_org_+_1 +17 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1 +369 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1 +139 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2 +155 -0
- data/tests/vcloud/data/api_+_v1.0_+_vdc_+_1 +61 -0
- data/tests/vcloud/models/compute/conn_helper.rb +20 -0
- data/tests/vcloud/models/compute/network_tests.rb +65 -0
- data/tests/vcloud/models/compute/networks_tests.rb +42 -0
- data/tests/vcloud/models/compute/organization_tests.rb +13 -0
- data/tests/vcloud/models/compute/organizations_tests.rb +14 -0
- data/tests/vcloud/models/compute/server_tests.rb +136 -0
- data/tests/vcloud/models/compute/servers_tests.rb +10 -89
- data/tests/vcloud/models/compute/vapp_tests.rb +27 -0
- data/tests/vcloud/models/compute/vapps_tests.rb +17 -0
- data/tests/vcloud/models/compute/vdc_tests.rb +42 -0
- data/tests/vcloud/models/compute/vdcs_tests.rb +17 -0
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +2 -6
- 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)
|
data/lib/fog/core/credentials.rb
CHANGED
@@ -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 [
|
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
|
data/lib/fog/core/errors.rb
CHANGED
@@ -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:
|
data/lib/fog/core/wait_for.rb
CHANGED
data/lib/fog/dnsmadeeasy/dns.rb
CHANGED
@@ -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
|
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
|
# )
|
data/lib/fog/libvirt/compute.rb
CHANGED
@@ -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
data/lib/fog/rackspace/dns.rb
CHANGED
@@ -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
|
@@ -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']
|
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
|