fog 1.6.0 → 1.7.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.
- data/.gitignore +1 -0
- data/README.md +1 -0
- data/Rakefile +2 -1
- data/changelog.txt +184 -0
- data/docs/cdn/index.markdown +69 -3
- data/fog.gemspec +2 -2
- data/lib/fog.rb +2 -1
- data/lib/fog/atmos/models/storage/file.rb +16 -14
- data/lib/fog/aws/auto_scaling.rb +55 -13
- data/lib/fog/aws/cdn.rb +69 -9
- data/lib/fog/aws/cloud_watch.rb +15 -1
- data/lib/fog/aws/compute.rb +2 -0
- data/lib/fog/aws/models/auto_scaling/group.rb +10 -4
- data/lib/fog/aws/models/cdn/distribution.rb +93 -0
- data/lib/fog/aws/models/cdn/distribution_helper.rb +64 -0
- data/lib/fog/aws/models/cdn/distributions.rb +32 -0
- data/lib/fog/aws/models/cdn/distributions_helper.rb +47 -0
- data/lib/fog/aws/models/cdn/invalidation.rb +64 -0
- data/lib/fog/aws/models/cdn/invalidations.rb +54 -0
- data/lib/fog/aws/models/cdn/streaming_distribution.rb +77 -0
- data/lib/fog/aws/models/cdn/streaming_distributions.rb +32 -0
- data/lib/fog/aws/models/compute/server.rb +0 -23
- data/lib/fog/aws/models/compute/spot_request.rb +2 -24
- data/lib/fog/aws/models/rds/server.rb +18 -0
- data/lib/fog/aws/models/rds/subnet_group.rb +20 -0
- data/lib/fog/aws/models/rds/subnet_groups.rb +27 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/auto_scaling/describe_adjustment_types.rb +15 -2
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb +39 -13
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_notification_types.rb +43 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb +3 -3
- data/lib/fog/aws/parsers/auto_scaling/describe_notification_configurations.rb +42 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_scaling_process_types.rb +15 -2
- data/lib/fog/aws/parsers/auto_scaling/describe_tags.rb +46 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_termination_policy_types.rb +44 -0
- data/lib/fog/aws/parsers/cdn/get_invalidation.rb +32 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +1 -1
- data/lib/fog/aws/parsers/cloud_watch/list_metrics.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_availability_zones.rb +13 -2
- data/lib/fog/aws/parsers/compute/describe_reserved_instances.rb +1 -1
- data/lib/fog/aws/parsers/elasticache/base.rb +0 -2
- data/lib/fog/aws/parsers/elasticache/engine_defaults_parser.rb +1 -1
- data/lib/fog/aws/parsers/elasticache/event_list.rb +2 -0
- data/lib/fog/aws/parsers/rds/base.rb +32 -0
- data/lib/fog/aws/parsers/rds/create_db_subnet_group.rb +38 -0
- data/lib/fog/aws/parsers/rds/describe_db_subnet_groups.rb +38 -0
- data/lib/fog/aws/parsers/rds/event_list.rb +40 -0
- data/lib/fog/aws/parsers/rds/subnet_group_parser.rb +38 -0
- data/lib/fog/aws/parsers/rds/tag_list_parser.rb +35 -0
- data/lib/fog/aws/rds.rb +24 -7
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +36 -16
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +19 -12
- data/lib/fog/aws/requests/auto_scaling/create_or_update_tags.rb +63 -0
- data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +10 -3
- data/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb +21 -5
- data/lib/fog/aws/requests/auto_scaling/delete_policy.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/delete_tags.rb +63 -0
- data/lib/fog/aws/requests/auto_scaling/describe_adjustment_types.rb +4 -3
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb +17 -13
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_notification_types.rb +55 -0
- data/lib/fog/aws/requests/auto_scaling/describe_metric_collection_types.rb +6 -5
- data/lib/fog/aws/requests/auto_scaling/describe_notification_configurations.rb +79 -0
- data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/describe_scaling_process_types.rb +4 -3
- data/lib/fog/aws/requests/auto_scaling/describe_tags.rb +74 -0
- data/lib/fog/aws/requests/auto_scaling/describe_termination_policy_types.rb +53 -0
- data/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb +30 -11
- data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +4 -4
- data/lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb +8 -5
- data/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/set_instance_health.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/suspend_processes.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +30 -18
- data/lib/fog/aws/requests/cdn/delete_distribution.rb +31 -0
- data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +30 -0
- data/lib/fog/aws/requests/cdn/get_distribution.rb +28 -0
- data/lib/fog/aws/requests/cdn/get_distribution_list.rb +29 -0
- data/lib/fog/aws/requests/cdn/get_invalidation.rb +60 -0
- data/lib/fog/aws/requests/cdn/get_invalidation_list.rb +41 -0
- data/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +26 -0
- data/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +30 -0
- data/lib/fog/aws/requests/cdn/post_distribution.rb +44 -0
- data/lib/fog/aws/requests/cdn/post_invalidation.rb +33 -0
- data/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +44 -0
- data/lib/fog/aws/requests/cdn/put_distribution_config.rb +28 -0
- data/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +28 -0
- data/lib/fog/aws/requests/compute/create_image.rb +32 -5
- data/lib/fog/aws/requests/compute/create_subnet.rb +3 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +2 -2
- data/lib/fog/aws/requests/compute/register_image.rb +1 -1
- data/lib/fog/aws/requests/elasticache/describe_events.rb +7 -4
- data/lib/fog/aws/requests/glacier/create_archive.rb +1 -1
- data/lib/fog/aws/requests/glacier/initiate_multipart_upload.rb +1 -1
- data/lib/fog/aws/requests/rds/add_tags_to_resource.rb +46 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +2 -0
- data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +58 -0
- data/lib/fog/aws/requests/rds/describe_db_subnet_groups.rb +63 -0
- data/lib/fog/aws/requests/rds/describe_events.rb +52 -0
- data/lib/fog/aws/requests/rds/list_tags_for_resource.rb +44 -0
- data/lib/fog/aws/requests/rds/remove_tags_from_resource.rb +44 -0
- data/lib/fog/aws/sqs.rb +1 -1
- data/lib/fog/aws/storage.rb +1 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/bluebox/models/compute/server.rb +0 -19
- data/lib/fog/bluebox/requests/compute/create_block.rb +8 -8
- data/lib/fog/brightbox/compute.rb +56 -7
- data/lib/fog/brightbox/models/compute/accounts.rb +29 -0
- data/lib/fog/brightbox/models/compute/api_client.rb +37 -0
- data/lib/fog/brightbox/models/compute/api_clients.rb +24 -0
- data/lib/fog/brightbox/models/compute/application.rb +27 -0
- data/lib/fog/brightbox/models/compute/applications.rb +28 -0
- data/lib/fog/brightbox/models/compute/server.rb +3 -1
- data/lib/fog/brightbox/models/compute/users.rb +1 -3
- data/lib/fog/brightbox/requests/compute/create_application.rb +13 -0
- data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +2 -2
- data/lib/fog/brightbox/requests/compute/destroy_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/get_account.rb +28 -4
- data/lib/fog/brightbox/requests/compute/get_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/get_authenticated_user.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_scoped_account.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_user.rb +28 -5
- data/lib/fog/brightbox/requests/compute/list_accounts.rb +13 -0
- data/lib/fog/brightbox/requests/compute/list_applications.rb +13 -0
- data/lib/fog/brightbox/requests/compute/reset_secret_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/update_account.rb +51 -3
- data/lib/fog/brightbox/requests/compute/update_application.rb +15 -0
- data/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +4 -2
- data/lib/fog/brightbox/requests/compute/update_scoped_account.rb +37 -0
- data/lib/fog/clodo/models/compute/server.rb +7 -44
- data/lib/fog/compute/models/server.rb +23 -2
- data/lib/fog/core/time.rb +2 -0
- data/lib/fog/core/wait_for.rb +0 -2
- data/lib/fog/ecloud/models/compute/servers.rb +3 -1
- data/lib/fog/ecloud/requests/compute/get_servers.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_tasks.rb +1 -1
- data/lib/fog/go_grid/models/compute/server.rb +0 -4
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/hp/models/compute/server.rb +1 -23
- data/lib/fog/hp/storage.rb +0 -1
- data/lib/fog/joyent/models/compute/server.rb +4 -0
- data/lib/fog/joyent/models/compute/servers.rb +4 -3
- data/lib/fog/libvirt/models/compute/server.rb +1 -27
- data/lib/fog/linode/models/compute/server.rb +0 -1
- data/lib/fog/local/models/storage/directory.rb +1 -1
- data/lib/fog/network.rb +26 -0
- data/lib/fog/ninefold/compute.rb +8 -0
- data/lib/fog/ninefold/requests/compute/assign_to_load_balancer_rule.rb +13 -0
- data/lib/fog/ninefold/requests/compute/create_load_balancer_rule.rb +11 -0
- data/lib/fog/ninefold/requests/compute/delete_load_balancer_rule.rb +11 -0
- data/lib/fog/ninefold/requests/compute/list_load_balancer_rule_instances.rb +15 -0
- data/lib/fog/ninefold/requests/compute/list_load_balancer_rules.rb +14 -0
- data/lib/fog/ninefold/requests/compute/remove_from_load_balancer_rule.rb +12 -0
- data/lib/fog/ninefold/requests/compute/update_load_balancer_rule.rb +15 -0
- data/lib/fog/ninefold/storage.rb +14 -112
- data/lib/fog/openstack.rb +4 -1
- data/lib/fog/openstack/compute.rb +20 -1
- data/lib/fog/openstack/identity.rb +67 -18
- data/lib/fog/openstack/image.rb +12 -4
- data/lib/fog/openstack/models/compute/security_group.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +5 -23
- data/lib/fog/openstack/models/identity/tenants.rb +5 -3
- data/lib/fog/openstack/models/identity/users.rb +4 -1
- data/lib/fog/openstack/models/image/image.rb +6 -1
- data/lib/fog/openstack/models/network/network.rb +46 -0
- data/lib/fog/openstack/models/network/networks.rb +34 -0
- data/lib/fog/openstack/models/network/port.rb +52 -0
- data/lib/fog/openstack/models/network/ports.rb +34 -0
- data/lib/fog/openstack/models/network/subnet.rb +55 -0
- data/lib/fog/openstack/models/network/subnets.rb +34 -0
- data/lib/fog/openstack/network.rb +234 -0
- data/lib/fog/openstack/requests/compute/attach_volume.rb +10 -0
- data/lib/fog/openstack/requests/compute/create_security_group.rb +15 -11
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +17 -15
- data/lib/fog/openstack/requests/compute/create_server.rb +7 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +10 -10
- data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +16 -1
- data/lib/fog/openstack/requests/compute/detach_volume.rb +5 -0
- data/lib/fog/openstack/requests/compute/get_snapshot_details.rb +4 -4
- data/lib/fog/openstack/requests/compute/get_volume_details.rb +9 -9
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +3 -3
- data/lib/fog/openstack/requests/compute/list_volumes.rb +14 -14
- data/lib/fog/openstack/requests/identity/create_tenant.rb +3 -3
- data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
- data/lib/fog/openstack/requests/identity/delete_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/get_tenant.rb +1 -1
- data/lib/fog/openstack/requests/identity/list_roles.rb +7 -0
- data/lib/fog/openstack/requests/image/create_image.rb +36 -38
- data/lib/fog/openstack/requests/image/delete_image.rb +0 -2
- data/lib/fog/openstack/requests/image/list_public_images.rb +7 -25
- data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +2 -41
- data/lib/fog/openstack/requests/image/update_image.rb +26 -21
- data/lib/fog/openstack/requests/image/update_image_members.rb +37 -0
- data/lib/fog/openstack/requests/network/create_network.rb +44 -0
- data/lib/fog/openstack/requests/network/create_port.rb +52 -0
- data/lib/fog/openstack/requests/network/create_subnet.rb +56 -0
- data/lib/fog/openstack/requests/network/delete_network.rb +30 -0
- data/lib/fog/openstack/requests/network/delete_port.rb +30 -0
- data/lib/fog/openstack/requests/network/delete_subnet.rb +30 -0
- data/lib/fog/openstack/requests/network/get_network.rb +42 -0
- data/lib/fog/openstack/requests/network/get_port.rb +48 -0
- data/lib/fog/openstack/requests/network/get_subnet.rb +49 -0
- data/lib/fog/openstack/requests/network/list_networks.rb +27 -0
- data/lib/fog/openstack/requests/network/list_ports.rb +27 -0
- data/lib/fog/openstack/requests/network/list_subnets.rb +27 -0
- data/lib/fog/openstack/requests/network/set_tenant.rb +21 -0
- data/lib/fog/openstack/requests/network/update_network.rb +41 -0
- data/lib/fog/openstack/requests/network/update_port.rb +44 -0
- data/lib/fog/openstack/requests/network/update_subnet.rb +44 -0
- data/lib/fog/openstack/requests/volume/create_volume.rb +10 -10
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +16 -1
- data/lib/fog/openstack/requests/volume/get_snapshot_details.rb +6 -6
- data/lib/fog/openstack/requests/volume/get_volume_details.rb +10 -10
- data/lib/fog/openstack/requests/volume/list_volumes.rb +14 -14
- data/lib/fog/openstack/volume.rb +10 -0
- data/lib/fog/rackspace/models/compute/server.rb +1 -24
- data/lib/fog/rackspace/models/compute_v2/server.rb +4 -2
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/server.rb +1 -5
- data/lib/fog/virtual_box/models/compute/server.rb +2 -44
- data/lib/fog/vmfusion/models/compute/server.rb +3 -36
- data/lib/fog/vsphere/models/compute/server.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +2 -31
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +35 -7
- data/tests/aws/models/cdn/distribution_tests.rb +15 -0
- data/tests/aws/models/cdn/distributions_tests.rb +15 -0
- data/tests/aws/models/cdn/invalidation_tests.rb +32 -0
- data/tests/aws/models/cdn/invalidations_tests.rb +15 -0
- data/tests/aws/models/cdn/streaming_distribution_tests.rb +15 -0
- data/tests/aws/models/cdn/streaming_distributions_tests.rb +15 -0
- data/tests/aws/models/rds/tagging_tests.rb +20 -0
- data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +1 -11
- data/tests/aws/requests/auto_scaling/describe_types_tests.rb +102 -0
- data/tests/aws/requests/auto_scaling/helper.rb +47 -3
- data/tests/aws/requests/auto_scaling/notification_configuration_tests.rb +123 -0
- data/tests/aws/requests/auto_scaling/tag_tests.rb +62 -0
- data/tests/aws/requests/cdn/cdn_tests.rb +252 -0
- data/tests/aws/requests/compute/image_tests.rb +32 -1
- data/tests/aws/requests/compute/volume_tests.rb +3 -3
- data/tests/aws/requests/rds/describe_events.rb +16 -0
- data/tests/aws/requests/rds/helper.rb +26 -0
- data/tests/aws/requests/rds/subnet_groups_test.rb +48 -0
- data/tests/aws/requests/rds/tagging_tests.rb +78 -0
- data/tests/brightbox/requests/compute/account_tests.rb +24 -4
- data/tests/brightbox/requests/compute/application_test.rb +63 -0
- data/tests/brightbox/requests/compute/helper.rb +49 -1
- data/tests/helper.rb +4 -1
- data/tests/local/models/directory_tests.rb +16 -0
- data/tests/ninefold/requests/compute/helper.rb +53 -0
- data/tests/ninefold/requests/compute/load_balancer_tests.rb +66 -0
- data/tests/openstack/models/image/image_tests.rb +1 -0
- data/tests/openstack/models/network/network_tests.rb +24 -0
- data/tests/openstack/models/network/networks_tests.rb +21 -0
- data/tests/openstack/models/network/port_tests.rb +28 -0
- data/tests/openstack/models/network/ports_tests.rb +25 -0
- data/tests/openstack/models/network/subnet_tests.rb +30 -0
- data/tests/openstack/models/network/subnets_tests.rb +27 -0
- data/tests/openstack/requests/compute/image_tests.rb +3 -4
- data/tests/openstack/requests/compute/quota_tests.rb +2 -0
- data/tests/openstack/requests/compute/security_group_tests.rb +10 -10
- data/tests/openstack/requests/compute/server_tests.rb +3 -1
- data/tests/openstack/requests/compute/volume_tests.rb +11 -12
- data/tests/openstack/requests/identity/tenant_tests.rb +2 -1
- data/tests/openstack/requests/image/image_tests.rb +66 -45
- data/tests/openstack/requests/network/network_tests.rb +56 -0
- data/tests/openstack/requests/network/port_tests.rb +63 -0
- data/tests/openstack/requests/network/subnet_tests.rb +66 -0
- data/tests/rackspace/models/identity/user_tests.rb +1 -1
- data/tests/rackspace/models/identity/users_tests.rb +1 -1
- metadata +137 -13
- data/lib/fog/ninefold/models/storage/directories.rb +0 -48
- data/lib/fog/ninefold/models/storage/directory.rb +0 -53
- data/lib/fog/ninefold/models/storage/file.rb +0 -108
- data/lib/fog/ninefold/models/storage/files.rb +0 -73
- data/lib/fog/ninefold/requests/storage/delete_namespace.rb +0 -19
- data/lib/fog/ninefold/requests/storage/get_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/head_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/post_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/put_namespace.rb +0 -20
data/lib/fog/openstack/volume.rb
CHANGED
@@ -48,6 +48,16 @@ module Fog
|
|
48
48
|
def initialize(options={})
|
49
49
|
require 'multi_json'
|
50
50
|
@openstack_username = options[:openstack_username]
|
51
|
+
@openstack_tenant = options[:openstack_tenant]
|
52
|
+
@openstack_auth_uri = URI.parse(options[:openstack_auth_url])
|
53
|
+
|
54
|
+
@auth_token = Fog::Mock.random_base64(64)
|
55
|
+
@auth_token_expiration = (Time.now.utc + 86400).iso8601
|
56
|
+
|
57
|
+
management_url = URI.parse(options[:openstack_auth_url])
|
58
|
+
management_url.port = 8776
|
59
|
+
management_url.path = '/v1'
|
60
|
+
@openstack_management_url = management_url.to_s
|
51
61
|
|
52
62
|
@data ||= { :users => {} }
|
53
63
|
unless @data[:users].find {|u| u['name'] == options[:openstack_username]}
|
@@ -19,7 +19,6 @@ module Fog
|
|
19
19
|
attribute :state, :aliases => 'status'
|
20
20
|
|
21
21
|
attr_reader :password
|
22
|
-
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
23
22
|
|
24
23
|
def initialize(attributes={})
|
25
24
|
self.flavor_id ||= 1 # 256 server
|
@@ -49,31 +48,13 @@ module Fog
|
|
49
48
|
end
|
50
49
|
|
51
50
|
def private_ip_address
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
def private_key_path
|
56
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
57
|
-
@private_key_path &&= File.expand_path(@private_key_path)
|
58
|
-
end
|
59
|
-
|
60
|
-
def private_key
|
61
|
-
@private_key ||= private_key_path && File.read(private_key_path)
|
51
|
+
addresses['private'].first
|
62
52
|
end
|
63
53
|
|
64
54
|
def public_ip_address
|
65
55
|
addresses['public'].first
|
66
56
|
end
|
67
57
|
|
68
|
-
def public_key_path
|
69
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
70
|
-
@public_key_path &&= File.expand_path(@public_key_path)
|
71
|
-
end
|
72
|
-
|
73
|
-
def public_key
|
74
|
-
@public_key ||= public_key_path && File.read(public_key_path)
|
75
|
-
end
|
76
|
-
|
77
58
|
def ready?
|
78
59
|
self.state == 'ACTIVE'
|
79
60
|
end
|
@@ -112,10 +93,6 @@ module Fog
|
|
112
93
|
retry
|
113
94
|
end
|
114
95
|
|
115
|
-
def username
|
116
|
-
@username ||= 'root'
|
117
|
-
end
|
118
|
-
|
119
96
|
private
|
120
97
|
|
121
98
|
def adminPass=(new_admin_pass)
|
@@ -40,7 +40,7 @@ module Fog
|
|
40
40
|
attribute :addresses
|
41
41
|
attribute :flavor_id, :aliases => 'flavor', :squash => 'id'
|
42
42
|
attribute :image_id, :aliases => 'image', :squash => 'id'
|
43
|
-
|
43
|
+
|
44
44
|
attr_reader :password
|
45
45
|
|
46
46
|
def save
|
@@ -54,7 +54,9 @@ module Fog
|
|
54
54
|
|
55
55
|
def create
|
56
56
|
requires :name, :image_id, :flavor_id
|
57
|
-
|
57
|
+
options = {}
|
58
|
+
options[:disk_config] = disk_config unless disk_config.nil?
|
59
|
+
data = connection.create_server(name, image_id, flavor_id, 1, 1, options)
|
58
60
|
merge_attributes(data.body['server'])
|
59
61
|
true
|
60
62
|
end
|
@@ -13,7 +13,7 @@ module Fog
|
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
16
|
-
data['server']['diskConfig'] = options[:disk_config] unless options[:disk_config].nil?
|
16
|
+
data['server']['OS-DCF:diskConfig'] = options[:disk_config] unless options[:disk_config].nil?
|
17
17
|
|
18
18
|
request(
|
19
19
|
:body => Fog::JSON.encode(data),
|
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
attribute :zone
|
27
27
|
attribute :active
|
28
28
|
|
29
|
-
attr_writer :password
|
29
|
+
attr_writer :password
|
30
30
|
|
31
31
|
def initialize(attributes={})
|
32
32
|
super
|
@@ -53,10 +53,6 @@ module Fog
|
|
53
53
|
true
|
54
54
|
end
|
55
55
|
|
56
|
-
def username
|
57
|
-
@username ||= 'root'
|
58
|
-
end
|
59
|
-
|
60
56
|
def clone(options)
|
61
57
|
requires :identity
|
62
58
|
connection.clone_server({:uniq_id => identity}.merge!(options))
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'fog/
|
1
|
+
require 'fog/compute/models/server'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
5
5
|
class VirtualBox
|
6
6
|
|
7
|
-
class Server < Fog::
|
7
|
+
class Server < Fog::Compute::Server
|
8
8
|
|
9
9
|
identity :id
|
10
10
|
|
@@ -69,8 +69,6 @@ module Fog
|
|
69
69
|
# property :usb_controller, :USBController, :readonly => true
|
70
70
|
# property :vrde_server, :VRDEServer, :readonly => true
|
71
71
|
|
72
|
-
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
73
|
-
|
74
72
|
def initialize(attributes={})
|
75
73
|
self.memory_size = 256
|
76
74
|
self.rtc_use_utc = true
|
@@ -102,28 +100,10 @@ module Fog
|
|
102
100
|
nil
|
103
101
|
end
|
104
102
|
|
105
|
-
def private_key_path
|
106
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
107
|
-
@private_key_path &&= File.expand_path(@private_key_path)
|
108
|
-
end
|
109
|
-
|
110
|
-
def private_key
|
111
|
-
@private_key ||= private_key_path && File.read(private_key_path)
|
112
|
-
end
|
113
|
-
|
114
103
|
def public_ip_address
|
115
104
|
nil
|
116
105
|
end
|
117
106
|
|
118
|
-
def public_key_path
|
119
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
120
|
-
@public_key_path &&= File.expand_path(@public_key_path)
|
121
|
-
end
|
122
|
-
|
123
|
-
def public_key
|
124
|
-
@public_key ||= public_key_path && File.read(public_key_path)
|
125
|
-
end
|
126
|
-
|
127
107
|
def ready?
|
128
108
|
status == :running
|
129
109
|
end
|
@@ -151,15 +131,6 @@ module Fog
|
|
151
131
|
end
|
152
132
|
end
|
153
133
|
|
154
|
-
def scp(local_path, remote_path, upload_options = {})
|
155
|
-
raise 'Not Implemented'
|
156
|
-
# requires :addresses, :username
|
157
|
-
#
|
158
|
-
# options = {}
|
159
|
-
# options[:key_data] = [private_key] if private_key
|
160
|
-
# Fog::SCP.new(addresses['public'].first, username, options).upload(local_path, remote_path, scp_options)
|
161
|
-
end
|
162
|
-
|
163
134
|
def setup(credentials = {})
|
164
135
|
raise 'Not Implemented'
|
165
136
|
# requires :addresses, :identity, :public_key, :username
|
@@ -175,15 +146,6 @@ module Fog
|
|
175
146
|
# retry
|
176
147
|
end
|
177
148
|
|
178
|
-
def ssh(commands)
|
179
|
-
raise 'Not Implemented'
|
180
|
-
# requires :addresses, :identity, :username
|
181
|
-
#
|
182
|
-
# options = {}
|
183
|
-
# options[:key_data] = [private_key] if private_key
|
184
|
-
# Fog::SSH.new(addresses['public'].first, username, options).run(commands)
|
185
|
-
end
|
186
|
-
|
187
149
|
def start(type = 'headless')
|
188
150
|
requires :raw
|
189
151
|
# session, type in ['gui', 'headless'], key[=value]\n env variables
|
@@ -204,10 +166,6 @@ module Fog
|
|
204
166
|
)
|
205
167
|
end
|
206
168
|
|
207
|
-
def username
|
208
|
-
@username ||= 'root'
|
209
|
-
end
|
210
|
-
|
211
169
|
private
|
212
170
|
|
213
171
|
def raw
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'fog/
|
1
|
+
require 'fog/compute/models/server'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
5
5
|
class Vmfusion
|
6
6
|
|
7
|
-
class Server < Fog::
|
7
|
+
class Server < Fog::Compute::Server
|
8
8
|
|
9
9
|
identity :name
|
10
10
|
|
@@ -14,7 +14,6 @@ module Fog
|
|
14
14
|
attribute :path
|
15
15
|
|
16
16
|
attr_accessor :password
|
17
|
-
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
18
17
|
|
19
18
|
# There is currently no documented model of creating VMs from scratch
|
20
19
|
# sans Fusion's wizard.
|
@@ -179,21 +178,9 @@ module Fog
|
|
179
178
|
# Sets up a conveinent way to SSH into a Fusion VM using credentials
|
180
179
|
# stored in your .fog file.
|
181
180
|
|
182
|
-
def username
|
183
|
-
@username ||= 'root'
|
184
|
-
end
|
185
|
-
|
186
181
|
# Simply spawn an SSH session.
|
187
182
|
def ssh(commands)
|
188
|
-
|
189
|
-
|
190
|
-
#requires :password, :private_key
|
191
|
-
ssh_options={}
|
192
|
-
ssh_options[:password] = password unless password.nil?
|
193
|
-
ssh_options[:key_data] = [private_key] if private_key
|
194
|
-
|
195
|
-
Fog::SSH.new(ipaddress, @username, ssh_options).run(commands)
|
196
|
-
|
183
|
+
super(commands, password ? {:password => password} : {})
|
197
184
|
end
|
198
185
|
|
199
186
|
# SCP something to our VM.
|
@@ -238,26 +225,6 @@ module Fog
|
|
238
225
|
Fog::SSH.new(ipaddress, username, credentials).run(commands)
|
239
226
|
end
|
240
227
|
|
241
|
-
# Just setting local versions of some variables that were going to use
|
242
|
-
# for SSH operations.
|
243
|
-
def private_key_path
|
244
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
245
|
-
@private_key_path &&= File.expand_path(@private_key_path)
|
246
|
-
end
|
247
|
-
|
248
|
-
def private_key
|
249
|
-
@private_key ||= private_key_path && File.read(private_key_path)
|
250
|
-
end
|
251
|
-
|
252
|
-
def public_key_path
|
253
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
254
|
-
@public_key_path &&= File.expand_path(@public_key_path)
|
255
|
-
end
|
256
|
-
|
257
|
-
def public_key
|
258
|
-
@public_key ||= public_key_path && File.read(public_key_path)
|
259
|
-
end
|
260
|
-
|
261
228
|
private
|
262
229
|
def ip(fission)
|
263
230
|
first_int = fission.network_info.data.keys.first
|
@@ -24,7 +24,7 @@ module Fog
|
|
24
24
|
attribute :instance_uuid
|
25
25
|
attribute :hostname
|
26
26
|
attribute :operatingsystem
|
27
|
-
attribute :ipaddress
|
27
|
+
attribute :ipaddress, :aliases => 'public_ip_address'
|
28
28
|
attribute :power_state, :aliases => 'power'
|
29
29
|
attribute :tools_state, :aliases => 'tools'
|
30
30
|
attribute :tools_version
|
@@ -85,39 +85,10 @@ module Fog
|
|
85
85
|
# As a result, we need a list of all virtual machines, and we
|
86
86
|
# need them in "native" format, not filter attribute format.
|
87
87
|
def list_all_virtual_machine_mobs
|
88
|
-
virtual_machines = Array.new
|
89
88
|
# Find each datacenter
|
90
|
-
datacenters = @connection.rootFolder.
|
91
|
-
child.kind_of? RbVmomi::VIM::Datacenter
|
92
|
-
end
|
89
|
+
datacenters = @connection.rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter)
|
93
90
|
# Next, search the "vmFolder" inventory of each data center:
|
94
|
-
datacenters.
|
95
|
-
inventory = dc.vmFolder.inventory( 'VirtualMachine' => :all )
|
96
|
-
virtual_machines << find_all_in_inventory(inventory, :type => RbVmomi::VIM::VirtualMachine, :property => 'name' )
|
97
|
-
end
|
98
|
-
|
99
|
-
virtual_machines.flatten
|
100
|
-
end
|
101
|
-
|
102
|
-
def find_all_in_inventory(inventory, properties = { :type => RbVmomi::VIM::VirtualMachine, :property => nil } )
|
103
|
-
results = Array.new
|
104
|
-
|
105
|
-
inventory.each do |k,v|
|
106
|
-
|
107
|
-
# If we have a VMware folder we need to traverse the directory
|
108
|
-
# to ensure we pick VMs inside folders. So we do a bit of recursion
|
109
|
-
# here.
|
110
|
-
results << find_all_in_inventory(v) if k.is_a? RbVmomi::VIM::Folder
|
111
|
-
|
112
|
-
if v[0].is_a? properties[:type]
|
113
|
-
if properties[:property].nil?
|
114
|
-
results << v[0]
|
115
|
-
else
|
116
|
-
results << v[1][properties[:property]]
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
results.flatten
|
91
|
+
datacenters.map {|dc| dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine) }.flatten
|
121
92
|
end
|
122
93
|
|
123
94
|
def get_folder_path(folder, root = nil)
|
@@ -30,17 +30,43 @@ module Fog
|
|
30
30
|
|
31
31
|
class Real
|
32
32
|
include Shared
|
33
|
+
|
34
|
+
# Clones a VM from a template or existing machine on your vSphere
|
35
|
+
# Server.
|
36
|
+
#
|
37
|
+
# ==== Parameters
|
38
|
+
# * options<~Hash>:
|
39
|
+
# * 'template_path'<~String> - *REQUIRED* The path to the machine you
|
40
|
+
# want to clone FROM. (Example:
|
41
|
+
# "/Datacenter/DataCenterNameHere/FolderNameHere/VMNameHere")
|
42
|
+
# * 'name'<~String> - *REQUIRED* The VMName of the Destination
|
43
|
+
# * 'resource_pool'<~String> - The resource pool on your datacenter
|
44
|
+
# cluster you want to use.
|
45
|
+
# * 'dest_folder'<~String> - Destination Folder of where 'name' will
|
46
|
+
# be placed on your cluster. *NOT TESTED OR VALIDATED*
|
47
|
+
# * 'power_on'<~Boolean> - Whether to power on machine after clone.
|
48
|
+
# Defaults to true.
|
49
|
+
# * 'wait'<~Boolean> - Whether the method should wait for the virtual
|
50
|
+
# machine to close finish cloning before returning information from
|
51
|
+
# vSphere. Returns the value of the machine if it finishes cloning
|
52
|
+
# in 150 seconds (1m30s) else it returns nil. 'wait' Defaults to nil.
|
53
|
+
# Saves a little time.
|
54
|
+
# * 'transform'<~String> - Not documented - see http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.RelocateSpec.html
|
55
|
+
#
|
33
56
|
def vm_clone(options = {})
|
34
57
|
# Option handling
|
35
58
|
options = vm_clone_check_options(options)
|
36
59
|
|
60
|
+
# Added for people still using options['path']
|
61
|
+
template_path = options['path'] || options['template_path']
|
62
|
+
|
37
63
|
notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "Could not find VM template" }
|
38
64
|
|
39
65
|
# Find the template in the folder. This is more efficient than
|
40
66
|
# searching ALL VM's looking for the template.
|
41
67
|
# Tap gets rid of the leading empty string and "Datacenters" element
|
42
68
|
# and returns the array.
|
43
|
-
path_elements =
|
69
|
+
path_elements = template_path.split('/').tap { |ary| ary.shift 2 }
|
44
70
|
# The DC name itself.
|
45
71
|
template_dc = path_elements.shift
|
46
72
|
# If the first path element contains "vm" this denotes the vmFolder
|
@@ -69,10 +95,10 @@ module Fog
|
|
69
95
|
# Now find the template itself using the efficient find method
|
70
96
|
vm_mob_ref = folder.find(template_name, RbVmomi::VIM::VirtualMachine)
|
71
97
|
|
72
|
-
# Now find _a_ resource pool to use for the clone
|
73
|
-
|
74
|
-
|
75
|
-
|
98
|
+
# Now find _a_ resource pool to use for the clone if one is not specified
|
99
|
+
if ( options.has_key?('resource_pool') )
|
100
|
+
resource_pool = options['resource_pool']
|
101
|
+
elsif ( vm_mob_ref.resourcePool == nil )
|
76
102
|
# If the template is really a template then there is no associated resource pool,
|
77
103
|
# so we need to find one using the template's parent host or cluster
|
78
104
|
esx_host = vm_mob_ref.collect!('runtime.host')['runtime.host']
|
@@ -123,9 +149,11 @@ module Fog
|
|
123
149
|
end
|
124
150
|
# And the clone specification
|
125
151
|
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(:location => relocation_spec,
|
126
|
-
:powerOn => options['power_on']
|
152
|
+
:powerOn => options.has_key?('power_on') ? options['power_on'] : true,
|
127
153
|
:template => false)
|
128
|
-
task = vm_mob_ref.CloneVM_Task(:folder =>
|
154
|
+
task = vm_mob_ref.CloneVM_Task(:folder => options.has_key?('dest_folder') ? options['dest_folder'] : vm_mob_ref.parent,
|
155
|
+
:name => options['name'],
|
156
|
+
:spec => clone_spec)
|
129
157
|
# Waiting for the VM to complete allows us to get the VirtulMachine
|
130
158
|
# object of the new machine when it's done. It is HIGHLY recommended
|
131
159
|
# to set 'wait' => true if your app wants to wait. Otherwise, you're
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Shindo.tests("Fog::CDN[:aws] | distribution", ['aws', 'cdn']) do
|
2
|
+
params = { :s3_origin => { 'DNSName' => 'fog_test_cdn.s3.amazonaws.com'}, :enabled => true }
|
3
|
+
model_tests(Fog::CDN[:aws].distributions, params, true) do
|
4
|
+
# distribution needs to be ready before being disabled
|
5
|
+
tests("#ready? - may take 15 minutes to complete...").succeeds do
|
6
|
+
@instance.wait_for { ready? }
|
7
|
+
end
|
8
|
+
|
9
|
+
# and disabled before being distroyed
|
10
|
+
tests("#disable - may take 15 minutes to complete...").succeeds do
|
11
|
+
@instance.disable
|
12
|
+
@instance.wait_for { ready? }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Shindo.tests("Fog::CDN[:aws] | distributions", ['aws', 'cdn']) do
|
2
|
+
params = { :s3_origin => { 'DNSName' => 'fog_test_cdn.s3.amazonaws.com'}, :enabled => true}
|
3
|
+
collection_tests(Fog::CDN[:aws].distributions, params, true) do
|
4
|
+
# distribution needs to be ready before being disabled
|
5
|
+
tests("#ready? - may take 15 minutes to complete...").succeeds do
|
6
|
+
@instance.wait_for { ready? }
|
7
|
+
end
|
8
|
+
|
9
|
+
# and disabled before being distroyed
|
10
|
+
tests("#disable - may take 15 minutes to complete...").succeeds do
|
11
|
+
@instance.disable
|
12
|
+
@instance.wait_for { ready? }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|