fog 1.24.0 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +184 -1
- data/CONTRIBUTORS.md +23 -0
- data/README.md +17 -9
- data/Rakefile +4 -0
- data/fog.gemspec +18 -6
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/auto_scaling.rb +12 -12
- data/lib/fog/aws/beanstalk.rb +12 -10
- data/lib/fog/aws/cdn.rb +0 -1
- data/lib/fog/aws/cloud_formation.rb +13 -11
- data/lib/fog/aws/cloud_watch.rb +14 -11
- data/lib/fog/aws/compute.rb +19 -19
- data/lib/fog/aws/core.rb +21 -0
- data/lib/fog/aws/dns.rb +0 -1
- data/lib/fog/aws/elasticache.rb +13 -9
- data/lib/fog/aws/elb.rb +23 -14
- data/lib/fog/aws/emr.rb +11 -9
- data/lib/fog/aws/iam.rb +14 -11
- data/lib/fog/aws/models/compute/security_group.rb +41 -0
- data/lib/fog/aws/models/elb/load_balancer.rb +31 -0
- data/lib/fog/aws/models/glacier/archive.rb +3 -1
- data/lib/fog/aws/models/iam/role.rb +1 -1
- data/lib/fog/aws/models/iam/roles.rb +1 -1
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +68 -53
- data/lib/fog/aws/parsers/elb/describe_load_balancer_attributes.rb +7 -0
- data/lib/fog/aws/parsers/elb/describe_tags.rb +26 -0
- data/lib/fog/aws/parsers/elb/tag_list_parser.rb +57 -0
- data/lib/fog/aws/parsers/storage/get_bucket_website.rb +5 -1
- data/lib/fog/aws/rds.rb +13 -11
- data/lib/fog/aws/region_methods.rb +1 -1
- data/lib/fog/aws/requests/dynamodb/put_item.rb +1 -1
- data/lib/fog/aws/requests/elb/add_tags.rb +46 -0
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +4 -1
- data/lib/fog/aws/requests/elb/describe_load_balancer_attributes.rb +3 -0
- data/lib/fog/aws/requests/elb/describe_tags.rb +56 -0
- data/lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb +9 -3
- data/lib/fog/aws/requests/elb/remove_tags.rb +46 -0
- data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
- data/lib/fog/aws/requests/storage/delete_object.rb +4 -3
- data/lib/fog/aws/requests/storage/post_object_hidden_fields.rb +23 -5
- data/lib/fog/aws/requests/storage/post_object_restore.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_website.rb +46 -18
- data/lib/fog/aws/ses.rb +1 -2
- data/lib/fog/aws/signaturev4.rb +62 -15
- data/lib/fog/aws/simpledb.rb +0 -1
- data/lib/fog/aws/sns.rb +12 -9
- data/lib/fog/aws/sqs.rb +14 -10
- data/lib/fog/aws/storage.rb +102 -78
- data/lib/fog/aws/sts.rb +10 -9
- data/lib/fog/bare_metal_cloud/compute.rb +0 -1
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/brightbox.rb +3 -1
- data/lib/fog/bin/rackspace.rb +4 -0
- data/lib/fog/bluebox/models/compute/server.rb +1 -0
- data/lib/fog/cloudstack/models/compute/server.rb +12 -1
- data/lib/fog/cloudstack/models/compute/snapshots.rb +3 -2
- data/lib/fog/cloudstack/models/compute/volume.rb +5 -0
- data/lib/fog/cloudstack/models/compute/volumes.rb +3 -2
- data/lib/fog/core/parser.rb +2 -112
- data/lib/fog/dnsmadeeasy/dns.rb +0 -1
- data/lib/fog/dynect/core.rb +0 -1
- data/lib/fog/dynect/dns.rb +11 -3
- data/lib/fog/ecloud/compute.rb +0 -1
- data/lib/fog/ecloud/core.rb +1 -1
- data/lib/fog/fogdocker/compute.rb +4 -1
- data/lib/fog/fogdocker/core.rb +1 -7
- data/lib/fog/fogdocker/errors.rb +9 -0
- data/lib/fog/fogdocker/models/compute/images.rb +4 -0
- data/lib/fog/fogdocker/models/compute/server.rb +18 -1
- data/lib/fog/fogdocker/requests/compute/container_action.rb +53 -3
- data/lib/fog/fogdocker/requests/compute/container_get.rb +31 -12
- data/lib/fog/fogdocker/requests/compute/image_search.rb +29 -0
- data/lib/fog/google/dns.rb +46 -12
- data/lib/fog/google/examples/dns/project.rb +8 -0
- data/lib/fog/google/examples/dns/zones.rb +43 -0
- data/lib/fog/google/models/compute/images.rb +2 -1
- data/lib/fog/google/models/dns/change.rb +40 -0
- data/lib/fog/google/models/dns/changes.rb +52 -0
- data/lib/fog/google/models/dns/project.rb +75 -0
- data/lib/fog/google/models/dns/projects.rb +25 -0
- data/lib/fog/google/models/dns/record.rb +112 -0
- data/lib/fog/google/models/dns/records.rb +52 -0
- data/lib/fog/google/models/dns/zone.rb +74 -0
- data/lib/fog/google/models/dns/zones.rb +34 -0
- data/lib/fog/google/models/storage/file.rb +1 -1
- data/lib/fog/google/models/storage/files.rb +1 -5
- data/lib/fog/google/requests/dns/create_change.rb +64 -0
- data/lib/fog/google/requests/dns/create_managed_zone.rb +64 -31
- data/lib/fog/google/requests/dns/delete_managed_zone.rb +20 -24
- data/lib/fog/google/requests/dns/get_change.rb +42 -0
- data/lib/fog/google/requests/dns/get_managed_zone.rb +22 -16
- data/lib/fog/google/requests/dns/get_project.rb +42 -0
- data/lib/fog/google/requests/dns/list_changes.rb +41 -0
- data/lib/fog/google/requests/dns/list_managed_zones.rb +15 -10
- data/lib/fog/google/requests/dns/list_resource_record_sets.rb +50 -0
- data/lib/fog/google/storage.rb +0 -1
- data/lib/fog/hp/storage.rb +1 -1
- data/lib/fog/internet_archive/storage.rb +0 -1
- data/lib/fog/libvirt/models/compute/server.rb +17 -7
- data/lib/fog/opennebula/models/compute/flavor.rb +46 -8
- data/lib/fog/opennebula/models/compute/flavors.rb +7 -0
- data/lib/fog/opennebula/models/compute/interface.rb +1 -1
- data/lib/fog/opennebula/models/compute/network.rb +1 -0
- data/lib/fog/opennebula/models/compute/networks.rb +5 -1
- data/lib/fog/opennebula/requests/compute/list_networks.rb +34 -25
- data/lib/fog/opennebula/requests/compute/template_pool.rb +47 -5
- data/lib/fog/openstack/compute.rb +2 -2
- data/lib/fog/openstack/docs/storage.md +18 -0
- data/lib/fog/openstack/identity.rb +1 -1
- data/lib/fog/openstack/image.rb +1 -1
- data/lib/fog/openstack/metering.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +1 -0
- data/lib/fog/openstack/models/storage/directory.rb +8 -2
- data/lib/fog/openstack/network.rb +1 -1
- data/lib/fog/openstack/orchestration.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/openstack/requests/storage/public_url.rb +28 -0
- data/lib/fog/openstack/requests/storage/put_container.rb +1 -0
- data/lib/fog/openstack/storage.rb +1 -0
- data/lib/fog/openstack/volume.rb +1 -1
- data/lib/fog/ovirt/compute.rb +1 -0
- data/lib/fog/ovirt/models/compute/server.rb +5 -0
- data/lib/fog/ovirt/requests/compute/update_volume.rb +39 -0
- data/lib/fog/rackspace.rb +1 -0
- data/lib/fog/rackspace/core.rb +1 -0
- data/lib/fog/rackspace/docs/networking.md +315 -0
- data/lib/fog/rackspace/mock_data.rb +1 -2
- data/lib/fog/rackspace/models/dns/zones.rb +2 -1
- data/lib/fog/rackspace/models/load_balancers/node.rb +7 -0
- data/lib/fog/rackspace/models/networking/network.rb +27 -0
- data/lib/fog/rackspace/models/networking/networks.rb +23 -0
- data/lib/fog/rackspace/models/networking/virtual_interface.rb +85 -0
- data/lib/fog/rackspace/models/networking/virtual_interfaces.rb +45 -0
- data/lib/fog/rackspace/models/queues/queue.rb +1 -1
- data/lib/fog/rackspace/networking.rb +192 -0
- data/lib/fog/rackspace/requests/load_balancers/create_node.rb +3 -0
- data/lib/fog/rackspace/requests/load_balancers/update_node.rb +3 -0
- data/lib/fog/rackspace/requests/networking/create_network.rb +36 -0
- data/lib/fog/rackspace/requests/networking/create_virtual_interface.rb +30 -0
- data/lib/fog/rackspace/requests/networking/delete_network.rb +21 -0
- data/lib/fog/rackspace/requests/networking/delete_virtual_interface.rb +23 -0
- data/lib/fog/rackspace/requests/networking/get_network.rb +21 -0
- data/lib/fog/rackspace/requests/networking/list_networks.rb +18 -0
- data/lib/fog/rackspace/requests/networking/list_virtual_interfaces.rb +22 -0
- data/lib/fog/vcloud/compute.rb +0 -1
- data/lib/fog/vcloud/core.rb +1 -0
- data/lib/fog/vcloud_director/compute.rb +1 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +38 -1
- data/lib/fog/vsphere/requests/compute/list_clusters.rb +31 -1
- data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +1 -1
- data/lib/fog/zerigo/dns.rb +0 -1
- data/lib/tasks/changelog_task.rb +1 -0
- data/tests/aws/models/elb/model_tests.rb +6 -0
- data/tests/aws/models/elb/tagging_tests.rb +15 -0
- data/tests/aws/models/iam/access_keys_tests.rb +1 -1
- data/tests/aws/models/iam/policies_tests.rb +2 -1
- data/tests/aws/models/iam/users_tests.rb +7 -4
- data/tests/aws/models/storage/url_tests.rb +5 -9
- data/tests/aws/requests/compute/tag_tests.rb +2 -0
- data/tests/aws/requests/elb/load_balancer_tests.rb +5 -1
- data/tests/aws/requests/storage/bucket_tests.rb +15 -1
- data/tests/aws/signaturev4_tests.rb +47 -0
- data/tests/bluebox/requests/compute/block_tests.rb +2 -1
- data/tests/compute/helper.rb +0 -10
- data/tests/compute/models/flavors_tests.rb +1 -1
- data/tests/fogdocker/compute_tests.rb +1 -1
- data/tests/fogdocker/models/compute/server_tests.rb +13 -3
- data/tests/fogdocker/requests/compute/container_action_tests.rb +19 -8
- data/tests/fogdocker/requests/compute/image_search_tests.rb +11 -0
- data/tests/google/models/dns/change_tests.rb +28 -0
- data/tests/google/models/dns/changes_tests.rb +36 -0
- data/tests/google/models/dns/projects_tests.rb +12 -0
- data/tests/google/models/dns/record_tests.rb +42 -0
- data/tests/google/models/dns/records_tests.rb +36 -0
- data/tests/google/models/dns/zone_tests.rb +28 -0
- data/tests/google/models/dns/zones_tests.rb +14 -0
- data/tests/google/requests/dns/change_tests.rb +86 -0
- data/tests/google/requests/dns/managed_zone_tests.rb +1 -1
- data/tests/google/requests/dns/project_tests.rb +29 -0
- data/tests/google/requests/dns/record_tests.rb +49 -0
- data/tests/helper.rb +1 -1
- data/tests/helpers/mock_helper.rb +2 -2
- data/tests/opennebula/models/compute/flavor_tests.rb +29 -0
- data/tests/opennebula/models/compute/flavors_tests.rb +17 -0
- data/tests/opennebula/models/compute/network_tests.rb +2 -2
- data/tests/opennebula/models/compute/networks_tests.rb +2 -0
- data/tests/openstack/requests/storage/object_tests.rb +10 -0
- data/tests/ovirt/compute_tests.rb +1 -1
- data/tests/ovirt/requests/compute/update_volume_tests.rb +20 -0
- data/tests/rackspace/models/networking/network_tests.rb +10 -0
- data/tests/rackspace/models/networking/networks_tests.rb +10 -0
- data/tests/rackspace/models/networking/virtual_interface_tests.rb +33 -0
- data/tests/rackspace/models/networking/virtual_interfaces_tests.rb +24 -0
- data/tests/rackspace/models/queues/queue_tests.rb +9 -0
- data/tests/rackspace/networking_tests.rb +118 -0
- data/tests/rackspace/requests/networking/network_tests.rb +49 -0
- data/tests/rackspace/requests/networking/virtual_interface_tests.rb +49 -0
- data/tests/vsphere/requests/compute/list_clusters_tests.rb +11 -0
- metadata +228 -180
- data/lib/fog/bin/terremark.rb +0 -29
- data/lib/fog/bin/vmfusion.rb +0 -58
- data/lib/fog/bin/voxel.rb +0 -29
- data/lib/fog/terremark.rb +0 -11
- data/lib/fog/terremark/models/shared/address.rb +0 -25
- data/lib/fog/terremark/models/shared/addresses.rb +0 -45
- data/lib/fog/terremark/models/shared/image.rb +0 -19
- data/lib/fog/terremark/models/shared/images.rb +0 -41
- data/lib/fog/terremark/models/shared/internetservice.rb +0 -66
- data/lib/fog/terremark/models/shared/internetservices.rb +0 -39
- data/lib/fog/terremark/models/shared/network.rb +0 -31
- data/lib/fog/terremark/models/shared/networks.rb +0 -48
- data/lib/fog/terremark/models/shared/nodeservice.rb +0 -50
- data/lib/fog/terremark/models/shared/nodeservices.rb +0 -29
- data/lib/fog/terremark/models/shared/server.rb +0 -210
- data/lib/fog/terremark/models/shared/servers.rb +0 -50
- data/lib/fog/terremark/models/shared/task.rb +0 -46
- data/lib/fog/terremark/models/shared/tasks.rb +0 -54
- data/lib/fog/terremark/models/shared/vdc.rb +0 -40
- data/lib/fog/terremark/models/shared/vdcs.rb +0 -48
- data/lib/fog/terremark/parser.rb +0 -18
- data/lib/fog/terremark/parsers/shared/get_catalog.rb +0 -33
- data/lib/fog/terremark/parsers/shared/get_catalog_item.rb +0 -32
- data/lib/fog/terremark/parsers/shared/get_internet_services.rb +0 -57
- data/lib/fog/terremark/parsers/shared/get_keys_list.rb +0 -39
- data/lib/fog/terremark/parsers/shared/get_network_ips.rb +0 -24
- data/lib/fog/terremark/parsers/shared/get_node_services.rb +0 -32
- data/lib/fog/terremark/parsers/shared/get_organization.rb +0 -50
- data/lib/fog/terremark/parsers/shared/get_organizations.rb +0 -31
- data/lib/fog/terremark/parsers/shared/get_public_ips.rb +0 -26
- data/lib/fog/terremark/parsers/shared/get_tasks_list.rb +0 -35
- data/lib/fog/terremark/parsers/shared/get_vapp_template.rb +0 -31
- data/lib/fog/terremark/parsers/shared/get_vdc.rb +0 -87
- data/lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb +0 -26
- data/lib/fog/terremark/parsers/shared/internet_service.rb +0 -58
- data/lib/fog/terremark/parsers/shared/network.rb +0 -39
- data/lib/fog/terremark/parsers/shared/node_service.rb +0 -28
- data/lib/fog/terremark/parsers/shared/public_ip.rb +0 -22
- data/lib/fog/terremark/parsers/shared/task.rb +0 -25
- data/lib/fog/terremark/parsers/shared/vapp.rb +0 -61
- data/lib/fog/terremark/requests/shared/add_internet_service.rb +0 -54
- data/lib/fog/terremark/requests/shared/add_node_service.rb +0 -51
- data/lib/fog/terremark/requests/shared/configure_vapp.rb +0 -59
- data/lib/fog/terremark/requests/shared/create_internet_service.rb +0 -59
- data/lib/fog/terremark/requests/shared/delete_internet_service.rb +0 -21
- data/lib/fog/terremark/requests/shared/delete_node_service.rb +0 -21
- data/lib/fog/terremark/requests/shared/delete_public_ip.rb +0 -21
- data/lib/fog/terremark/requests/shared/delete_vapp.rb +0 -20
- data/lib/fog/terremark/requests/shared/deploy_vapp.rb +0 -33
- data/lib/fog/terremark/requests/shared/get_catalog.rb +0 -30
- data/lib/fog/terremark/requests/shared/get_catalog_item.rb +0 -33
- data/lib/fog/terremark/requests/shared/get_internet_services.rb +0 -34
- data/lib/fog/terremark/requests/shared/get_keys_list.rb +0 -34
- data/lib/fog/terremark/requests/shared/get_network.rb +0 -69
- data/lib/fog/terremark/requests/shared/get_network_ips.rb +0 -29
- data/lib/fog/terremark/requests/shared/get_node_services.rb +0 -29
- data/lib/fog/terremark/requests/shared/get_organization.rb +0 -82
- data/lib/fog/terremark/requests/shared/get_organizations.rb +0 -45
- data/lib/fog/terremark/requests/shared/get_public_ip.rb +0 -31
- data/lib/fog/terremark/requests/shared/get_public_ips.rb +0 -68
- data/lib/fog/terremark/requests/shared/get_task.rb +0 -37
- data/lib/fog/terremark/requests/shared/get_tasks_list.rb +0 -30
- data/lib/fog/terremark/requests/shared/get_vapp.rb +0 -40
- data/lib/fog/terremark/requests/shared/get_vapp_template.rb +0 -33
- data/lib/fog/terremark/requests/shared/get_vdc.rb +0 -121
- data/lib/fog/terremark/requests/shared/instantiate_vapp_template.rb +0 -79
- data/lib/fog/terremark/requests/shared/power_off.rb +0 -33
- data/lib/fog/terremark/requests/shared/power_on.rb +0 -33
- data/lib/fog/terremark/requests/shared/power_reset.rb +0 -33
- data/lib/fog/terremark/requests/shared/power_shutdown.rb +0 -22
- data/lib/fog/terremark/shared.rb +0 -304
- data/lib/fog/terremark/vcloud.rb +0 -129
- data/lib/fog/vmfusion.rb +0 -1
- data/lib/fog/vmfusion/compute.rb +0 -28
- data/lib/fog/vmfusion/core.rb +0 -9
- data/lib/fog/vmfusion/models/compute/server.rb +0 -256
- data/lib/fog/vmfusion/models/compute/servers.rb +0 -36
- data/lib/fog/voxel.rb +0 -1
- data/lib/fog/voxel/compute.rb +0 -122
- data/lib/fog/voxel/core.rb +0 -16
- data/lib/fog/voxel/models/compute/image.rb +0 -13
- data/lib/fog/voxel/models/compute/images.rb +0 -27
- data/lib/fog/voxel/models/compute/server.rb +0 -73
- data/lib/fog/voxel/models/compute/servers.rb +0 -29
- data/lib/fog/voxel/parsers/compute/basic.rb +0 -27
- data/lib/fog/voxel/parsers/compute/devices_list.rb +0 -107
- data/lib/fog/voxel/parsers/compute/images_list.rb +0 -55
- data/lib/fog/voxel/parsers/compute/voxcloud_create.rb +0 -36
- data/lib/fog/voxel/parsers/compute/voxcloud_delete.rb +0 -27
- data/lib/fog/voxel/parsers/compute/voxcloud_status.rb +0 -42
- data/lib/fog/voxel/requests/compute/devices_list.rb +0 -22
- data/lib/fog/voxel/requests/compute/devices_power.rb +0 -20
- data/lib/fog/voxel/requests/compute/images_list.rb +0 -29
- data/lib/fog/voxel/requests/compute/voxcloud_create.rb +0 -20
- data/lib/fog/voxel/requests/compute/voxcloud_delete.rb +0 -18
- data/lib/fog/voxel/requests/compute/voxcloud_status.rb +0 -22
- data/lib/fog/xml.rb +0 -4
- data/lib/fog/xml/connection.rb +0 -24
- data/lib/fog/xml/sax_parser_connection.rb +0 -45
- data/tests/core/connection_tests.rb +0 -26
- data/tests/voxel/requests/compute/image_tests.rb +0 -52
- data/tests/voxel/requests/compute/server_tests.rb +0 -123
data/lib/fog/terremark/vcloud.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Terremark
|
3
|
-
module Vcloud
|
4
|
-
module Bin
|
5
|
-
end
|
6
|
-
|
7
|
-
module Defaults
|
8
|
-
HOST = 'services.vcloudexpress.terremark.com'
|
9
|
-
PATH = '/api/v0.8a-ext1.6'
|
10
|
-
#PATH = '/api/'
|
11
|
-
PORT = 443
|
12
|
-
SCHEME = 'https'
|
13
|
-
end
|
14
|
-
|
15
|
-
extend Fog::Terremark::Shared
|
16
|
-
|
17
|
-
def self.new(options={})
|
18
|
-
Fog::Logger.deprecation("Fog::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe [light_black](#{caller.first})[/]")
|
19
|
-
|
20
|
-
unless @required
|
21
|
-
shared_requires
|
22
|
-
@required = true
|
23
|
-
end
|
24
|
-
|
25
|
-
check_shared_options(options)
|
26
|
-
|
27
|
-
if Fog.mocking?
|
28
|
-
Fog::Terremark::Vcloud::Mock.new(options)
|
29
|
-
else
|
30
|
-
Fog::Terremark::Vcloud::Real.new(options)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class Real
|
35
|
-
include Fog::Terremark::Shared::Real
|
36
|
-
include Fog::Terremark::Shared::Parser
|
37
|
-
|
38
|
-
def initialize(options={})
|
39
|
-
@terremark_password = options[:terremark_vcloud_password]
|
40
|
-
@terremark_username = options[:terremark_vcloud_username]
|
41
|
-
@connection_options = options[:connection_options] || {}
|
42
|
-
@host = options[:host] || Fog::Terremark::Vcloud::Defaults::HOST
|
43
|
-
@path = options[:path] || Fog::Terremark::Vcloud::Defaults::PATH
|
44
|
-
@persistent = options[:persistent] || false
|
45
|
-
@port = options[:port] || Fog::Terremark::Vcloud::Defaults::PORT
|
46
|
-
@scheme = options[:scheme] || Fog::Terremark::Vcloud::Defaults::SCHEME
|
47
|
-
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
48
|
-
end
|
49
|
-
|
50
|
-
def default_vdc_id
|
51
|
-
if default_organization_id
|
52
|
-
@default_vdc_id ||= begin
|
53
|
-
vdcs = get_organization(default_organization_id).body['Links'].select {|link|
|
54
|
-
link['type'] == 'application/vnd.vmware.vcloud.vdc+xml'
|
55
|
-
}
|
56
|
-
if vdcs.length == 1
|
57
|
-
vdcs.first['href'].split('/').last.to_i
|
58
|
-
else
|
59
|
-
nil
|
60
|
-
end
|
61
|
-
end
|
62
|
-
else
|
63
|
-
nil
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def default_network_id
|
68
|
-
if default_vdc_id
|
69
|
-
@default_network_id ||= begin
|
70
|
-
networks = get_vdc(default_vdc_id).body['AvailableNetworks']
|
71
|
-
if networks.length == 1
|
72
|
-
networks.first['href'].split('/').last.to_i
|
73
|
-
else
|
74
|
-
nil
|
75
|
-
end
|
76
|
-
end
|
77
|
-
else
|
78
|
-
nil
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def default_public_ip_id
|
83
|
-
if default_vdc_id
|
84
|
-
@default_public_ip_id ||= begin
|
85
|
-
ips = get_public_ips(default_vdc_id).body['PublicIpAddresses']
|
86
|
-
if ips.length == 1
|
87
|
-
ips.first['href'].split('/').last.to_i
|
88
|
-
else
|
89
|
-
nil
|
90
|
-
end
|
91
|
-
end
|
92
|
-
else
|
93
|
-
nil
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def default_ssh_key
|
99
|
-
if default_ssh_key
|
100
|
-
@default_ssh_key ||= begin
|
101
|
-
keys = get_keys_list(default_organization_id).body["Keys"]
|
102
|
-
keys.find { |item| item["IsDefault"] == "true" }
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
class Mock
|
107
|
-
include Fog::Terremark::Shared::Mock
|
108
|
-
include Fog::Terremark::Shared::Parser
|
109
|
-
|
110
|
-
def initialize(option = {})
|
111
|
-
super
|
112
|
-
@base_url = Fog::Terremark::Vcloud::Defaults::SCHEME + "://" +
|
113
|
-
Fog::Terremark::Vcloud::Defaults::HOST +
|
114
|
-
Fog::Terremark::Vcloud::Defaults::PATH
|
115
|
-
|
116
|
-
@terremark_username = options[:terremark_vcloud_username]
|
117
|
-
end
|
118
|
-
|
119
|
-
def data
|
120
|
-
self.class.data[@terremark_username]
|
121
|
-
end
|
122
|
-
|
123
|
-
def reset_data
|
124
|
-
self.class.data.delete(@terremark_username)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
data/lib/fog/vmfusion.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'fog/vmfusion/compute'
|
data/lib/fog/vmfusion/compute.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'fog/vmfusion/core'
|
2
|
-
|
3
|
-
module Fog
|
4
|
-
module Compute
|
5
|
-
class Vmfusion < Fog::Service
|
6
|
-
model_path 'fog/vmfusion/models/compute'
|
7
|
-
model :server
|
8
|
-
collection :servers
|
9
|
-
|
10
|
-
class Mock
|
11
|
-
def initialize(options={})
|
12
|
-
Fog::Mock.not_implemented
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class Real
|
17
|
-
def initialize(options={})
|
18
|
-
begin
|
19
|
-
require 'fission'
|
20
|
-
rescue LoadError => e
|
21
|
-
retry if require('rubygems')
|
22
|
-
raise e.message
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/fog/vmfusion/core.rb
DELETED
@@ -1,256 +0,0 @@
|
|
1
|
-
require 'fog/compute/models/server'
|
2
|
-
|
3
|
-
module Fog
|
4
|
-
module Compute
|
5
|
-
class Vmfusion
|
6
|
-
class Server < Fog::Compute::Server
|
7
|
-
identity :name
|
8
|
-
|
9
|
-
attribute :ipaddress
|
10
|
-
attribute :power_state
|
11
|
-
attribute :mac_addresses
|
12
|
-
attribute :path
|
13
|
-
|
14
|
-
attr_accessor :password
|
15
|
-
|
16
|
-
# There is currently no documented model of creating VMs from scratch
|
17
|
-
# sans Fusion's wizard.
|
18
|
-
def save
|
19
|
-
raise Fog::Errors::Error.new('Creating a new vm is not yet supported')
|
20
|
-
end
|
21
|
-
|
22
|
-
# Fussion doesn't have the concept of templates so one just clones
|
23
|
-
# regular VMs.
|
24
|
-
def clone(name)
|
25
|
-
requires :raw
|
26
|
-
|
27
|
-
::Fission::VM.clone(@raw[:fission].name,name)
|
28
|
-
return service.servers.get(name)
|
29
|
-
end
|
30
|
-
|
31
|
-
# Destroy, deletes the VM from the local disk but only hard stops the VM
|
32
|
-
# before doing so if you set :force to true.
|
33
|
-
def destroy(options = { :force => false })
|
34
|
-
requires :raw
|
35
|
-
|
36
|
-
if ready?
|
37
|
-
if options[:force]
|
38
|
-
stop
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
@raw[:fission].delete
|
43
|
-
end
|
44
|
-
|
45
|
-
# Start is pretty self explanatory...if you pass :headless as true you
|
46
|
-
# won't get a console on launch.
|
47
|
-
def start(options = { :headless => false })
|
48
|
-
requires :raw
|
49
|
-
|
50
|
-
unless ready?
|
51
|
-
@raw[:fission].start(:headless => options[:headless])
|
52
|
-
return true
|
53
|
-
else
|
54
|
-
return false
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# We're covering a lot of bases here with the different ways one can
|
59
|
-
# stop a VM from running.
|
60
|
-
|
61
|
-
# Stop is a hard stop, like pulling out the power cord.
|
62
|
-
def stop
|
63
|
-
requires :raw
|
64
|
-
|
65
|
-
if ready?
|
66
|
-
@raw[:fission].stop(:hard => true)
|
67
|
-
return true
|
68
|
-
else
|
69
|
-
return false
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Halt and poweroff are just synonyms for stop.
|
74
|
-
def halt
|
75
|
-
stop
|
76
|
-
end
|
77
|
-
|
78
|
-
def poweroff
|
79
|
-
stop
|
80
|
-
end
|
81
|
-
|
82
|
-
# This is a graceful shutdown but Fusion is only capable of a graceful
|
83
|
-
# shutdown if tools are installed. Fusion does the right thing though
|
84
|
-
# and if graceful can't be initiated it just does a hard stop.
|
85
|
-
def shutdown
|
86
|
-
requires :raw
|
87
|
-
if ready?
|
88
|
-
@raw[:fission].stop
|
89
|
-
return true
|
90
|
-
else
|
91
|
-
return false
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
# Attempt a graceful shutdown, wait for the VM to completely shutdown
|
96
|
-
# and then start it again.
|
97
|
-
def reboot
|
98
|
-
if ready?
|
99
|
-
shutdown
|
100
|
-
wait_for { ! ready? }
|
101
|
-
start
|
102
|
-
return true
|
103
|
-
else
|
104
|
-
return false
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Resuming from suspend is the same thing as start to Fusion.
|
109
|
-
def resume
|
110
|
-
start
|
111
|
-
end
|
112
|
-
|
113
|
-
def suspend
|
114
|
-
requires :raw
|
115
|
-
if ready?
|
116
|
-
@raw[:fission].suspend
|
117
|
-
return true
|
118
|
-
else
|
119
|
-
return false
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
# Fusion VM Metadata.
|
124
|
-
|
125
|
-
# The power state of the VM is commonly going to be three values;
|
126
|
-
# running, not running, or suspended.
|
127
|
-
def power_state
|
128
|
-
requires :raw
|
129
|
-
@raw[:fission].state.data
|
130
|
-
end
|
131
|
-
|
132
|
-
def ready?
|
133
|
-
requires :raw
|
134
|
-
@raw[:fission].running?.data
|
135
|
-
end
|
136
|
-
|
137
|
-
# Path to the VM's vmx file on the local disk.
|
138
|
-
def path
|
139
|
-
requires :raw
|
140
|
-
@raw[:fission].path
|
141
|
-
end
|
142
|
-
|
143
|
-
# We obtain the first ipaddress. This should generally be a safe
|
144
|
-
# assumption for Fusion. Even if an address is provided via NAT,
|
145
|
-
# bridge, or host only it will by accessible from the host machine the
|
146
|
-
# VM resides on.
|
147
|
-
def ipaddress
|
148
|
-
requires :raw
|
149
|
-
ip(@raw[:fission])
|
150
|
-
end
|
151
|
-
|
152
|
-
# Keeping these three methods around for API compatibility reasons.
|
153
|
-
# Makes the vmfusion provider function similar to cloud providers and
|
154
|
-
# the vsphere provider. Future goal is to add an actual private and
|
155
|
-
# public concept. Needs changes to fission and a determination what is
|
156
|
-
# a public or private address here; bridge, nat, host-only.
|
157
|
-
def public_ip_address
|
158
|
-
ipaddress
|
159
|
-
end
|
160
|
-
|
161
|
-
def private_ip_address
|
162
|
-
ipaddress
|
163
|
-
end
|
164
|
-
|
165
|
-
def state
|
166
|
-
power_state
|
167
|
-
end
|
168
|
-
|
169
|
-
# Collecting all mac_addresses the VM has...mostly just because we are
|
170
|
-
# doing the same thing for the vSphere provider.
|
171
|
-
def mac_addresses
|
172
|
-
requires :raw
|
173
|
-
macs(@raw[:fission])
|
174
|
-
end
|
175
|
-
|
176
|
-
# Sets up a conveinent way to SSH into a Fusion VM using credentials
|
177
|
-
# stored in your .fog file.
|
178
|
-
|
179
|
-
# Simply spawn an SSH session.
|
180
|
-
def ssh(commands)
|
181
|
-
super(commands, password ? {:password => password} : {})
|
182
|
-
end
|
183
|
-
|
184
|
-
# SCP something to our VM.
|
185
|
-
def scp(local_path, remote_path, upload_options = {})
|
186
|
-
requires :ssh_ip_address, :username
|
187
|
-
|
188
|
-
scp_options = {}
|
189
|
-
scp_options[:password] = password unless self.password.nil?
|
190
|
-
scp_options[:key_data] = [private_key] if self.private_key
|
191
|
-
|
192
|
-
Fog::SCP.new(ssh_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
|
193
|
-
end
|
194
|
-
|
195
|
-
# Sets up a new SSH key on the VM so one doesn't need to use a password
|
196
|
-
# ever again.
|
197
|
-
def setup(credentials = {})
|
198
|
-
requires :public_key, :ssh_ip_address, :username
|
199
|
-
|
200
|
-
credentials[:password] = password unless self.password.nil?
|
201
|
-
credentails[:key_data] = [private_key] if self.private_key
|
202
|
-
|
203
|
-
commands = [
|
204
|
-
%{mkdir .ssh},
|
205
|
-
]
|
206
|
-
if public_key
|
207
|
-
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
208
|
-
end
|
209
|
-
|
210
|
-
# wait for domain to be ready
|
211
|
-
Timeout::timeout(360) do
|
212
|
-
begin
|
213
|
-
Timeout::timeout(8) do
|
214
|
-
Fog::SSH.new(ssh_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')
|
215
|
-
end
|
216
|
-
rescue Errno::ECONNREFUSED
|
217
|
-
sleep(2)
|
218
|
-
retry
|
219
|
-
rescue Net::SSH::AuthenticationFailed, Timeout::Error
|
220
|
-
retry
|
221
|
-
end
|
222
|
-
end
|
223
|
-
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
|
224
|
-
end
|
225
|
-
|
226
|
-
private
|
227
|
-
def ip(fission)
|
228
|
-
first_int = fission.network_info.data.keys.first
|
229
|
-
fission.network_info.data[first_int]['ip_address']
|
230
|
-
end
|
231
|
-
|
232
|
-
def macs(fission)
|
233
|
-
fission.mac_addresses.data
|
234
|
-
end
|
235
|
-
|
236
|
-
def raw
|
237
|
-
@raw
|
238
|
-
end
|
239
|
-
|
240
|
-
def raw=(new_raw)
|
241
|
-
@raw = new_raw
|
242
|
-
|
243
|
-
raw_attributes = {
|
244
|
-
:name => new_raw[:fission].name,
|
245
|
-
:power_state => new_raw[:state],
|
246
|
-
:ipaddress => ip(new_raw[:fission]),
|
247
|
-
:mac_addresses => macs(new_raw[:fission]),
|
248
|
-
:path => new_raw[:fission].path
|
249
|
-
}
|
250
|
-
|
251
|
-
merge_attributes(raw_attributes)
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/vmfusion/models/compute/server'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Compute
|
6
|
-
class Vmfusion
|
7
|
-
class Servers < Fog::Collection
|
8
|
-
model Fog::Compute::Vmfusion::Server
|
9
|
-
|
10
|
-
def all(filter = nil)
|
11
|
-
data = []
|
12
|
-
|
13
|
-
states = ::Fission::VM.all_with_status.data
|
14
|
-
|
15
|
-
filter = {} if filter.nil?
|
16
|
-
unless filter.key?(:name)
|
17
|
-
vms=::Fission::VM.all.data
|
18
|
-
vms.each do |vm|
|
19
|
-
data << { :raw => { :fission => vm,
|
20
|
-
:state => states[vm.name] } }
|
21
|
-
end
|
22
|
-
else
|
23
|
-
data << { :raw => { :fission => ::Fission::VM.new(filter[:name]),
|
24
|
-
:state => states[filter[:name]] } }
|
25
|
-
end
|
26
|
-
|
27
|
-
load(data)
|
28
|
-
end
|
29
|
-
|
30
|
-
def get(name)
|
31
|
-
self.all(:name => name).first
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|