fog 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +106 -17
- data/bin/fog +1 -1
- data/changelog.txt +17 -0
- data/docs/_layouts/default.html +2 -1
- data/docs/about/contributing.markdown +1 -1
- data/docs/compute/index.markdown +104 -0
- data/docs/index.markdown +1 -0
- data/docs/storage/index.markdown +17 -0
- data/fog.gemspec +3 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/elb.rb +1 -0
- data/lib/fog/aws/iam.rb +1 -0
- data/lib/fog/aws/rds.rb +1 -0
- data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +5 -5
- data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +3 -3
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +1 -1
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +5 -5
- data/lib/fog/aws/requests/simpledb/list_domains.rb +2 -2
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +6 -6
- data/lib/fog/aws/ses.rb +1 -0
- data/lib/fog/aws/simpledb.rb +8 -2
- data/lib/fog/bin.rb +2 -2
- data/lib/fog/cdn/aws.rb +8 -2
- data/lib/fog/cdn/rackspace.rb +8 -2
- data/lib/fog/compute/aws.rb +12 -3
- data/lib/fog/compute/bluebox.rb +8 -2
- data/lib/fog/compute/ecloud.rb +9 -4
- data/lib/fog/compute/go_grid.rb +8 -2
- data/lib/fog/compute/linode.rb +38 -6
- data/lib/fog/compute/models/aws/volumes.rb +4 -4
- data/lib/fog/compute/models/bluebox/server.rb +3 -3
- data/lib/fog/compute/models/brightbox/server.rb +9 -9
- data/lib/fog/compute/models/linode/data_center.rb +12 -0
- data/lib/fog/compute/models/linode/data_centers.rb +26 -0
- data/lib/fog/compute/models/linode/disk.rb +62 -0
- data/lib/fog/compute/models/linode/disks.rb +40 -0
- data/lib/fog/compute/models/linode/flavor.rb +23 -0
- data/lib/fog/compute/models/linode/flavors.rb +32 -0
- data/lib/fog/compute/models/linode/image.rb +14 -0
- data/lib/fog/compute/models/linode/images.rb +33 -0
- data/lib/fog/compute/models/linode/ip.rb +30 -0
- data/lib/fog/compute/models/linode/ips.rb +40 -0
- data/lib/fog/compute/models/linode/kernel.rb +12 -0
- data/lib/fog/compute/models/linode/kernels.rb +32 -0
- data/lib/fog/compute/models/linode/server.rb +88 -0
- data/lib/fog/compute/models/linode/servers.rb +32 -0
- data/lib/fog/compute/models/linode/stack_script.rb +13 -0
- data/lib/fog/compute/models/linode/stack_scripts.rb +32 -0
- data/lib/fog/compute/models/rackspace/server.rb +2 -2
- data/lib/fog/compute/models/slicehost/server.rb +2 -2
- data/lib/fog/compute/models/voxel/server.rb +3 -3
- data/lib/fog/compute/new_servers.rb +8 -2
- data/lib/fog/compute/rackspace.rb +8 -2
- data/lib/fog/compute/requests/aws/allocate_address.rb +4 -2
- data/lib/fog/compute/requests/aws/associate_address.rb +4 -2
- data/lib/fog/compute/requests/aws/attach_volume.rb +4 -2
- data/lib/fog/compute/requests/aws/authorize_security_group_ingress.rb +5 -3
- data/lib/fog/compute/requests/aws/create_image.rb +2 -1
- data/lib/fog/compute/requests/aws/create_key_pair.rb +4 -2
- data/lib/fog/compute/requests/aws/create_security_group.rb +5 -3
- data/lib/fog/compute/requests/aws/create_snapshot.rb +6 -4
- data/lib/fog/compute/requests/aws/create_tags.rb +7 -5
- data/lib/fog/compute/requests/aws/create_volume.rb +4 -2
- data/lib/fog/compute/requests/aws/delete_key_pair.rb +3 -1
- data/lib/fog/compute/requests/aws/delete_security_group.rb +4 -2
- data/lib/fog/compute/requests/aws/delete_snapshot.rb +3 -1
- data/lib/fog/compute/requests/aws/delete_tags.rb +5 -3
- data/lib/fog/compute/requests/aws/delete_volume.rb +4 -2
- data/lib/fog/compute/requests/aws/deregister_image.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_addresses.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_availability_zones.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_images.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_instances.rb +12 -10
- data/lib/fog/compute/requests/aws/describe_key_pairs.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_regions.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_reserved_instances.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_security_groups.rb +3 -1
- data/lib/fog/compute/requests/aws/describe_snapshots.rb +5 -3
- data/lib/fog/compute/requests/aws/describe_tags.rb +2 -0
- data/lib/fog/compute/requests/aws/describe_volumes.rb +9 -7
- data/lib/fog/compute/requests/aws/detach_volume.rb +3 -1
- data/lib/fog/compute/requests/aws/disassociate_address.rb +4 -2
- data/lib/fog/compute/requests/aws/get_console_output.rb +3 -1
- data/lib/fog/compute/requests/aws/get_password_data.rb +15 -1
- data/lib/fog/compute/requests/aws/import_key_pair.rb +4 -2
- data/lib/fog/compute/requests/aws/modify_image_attributes.rb +4 -0
- data/lib/fog/compute/requests/aws/modify_snapshot_attribute.rb +4 -0
- data/lib/fog/compute/requests/aws/monitor_instances.rb +3 -1
- data/lib/fog/compute/requests/aws/reboot_instances.rb +4 -2
- data/lib/fog/compute/requests/aws/register_image.rb +4 -0
- data/lib/fog/compute/requests/aws/release_address.rb +3 -1
- data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +3 -1
- data/lib/fog/compute/requests/aws/run_instances.rb +12 -6
- data/lib/fog/compute/requests/aws/start_instances.rb +2 -0
- data/lib/fog/compute/requests/aws/stop_instances.rb +2 -0
- data/lib/fog/compute/requests/aws/terminate_instances.rb +5 -3
- data/lib/fog/compute/requests/aws/unmonitor_instances.rb +3 -1
- data/lib/fog/compute/requests/go_grid/grid_image_get.rb +1 -1
- data/lib/fog/compute/requests/go_grid/grid_image_list.rb +1 -1
- data/lib/fog/compute/requests/linode/avail_datacenters.rb +1 -2
- data/lib/fog/compute/requests/linode/avail_distributions.rb +1 -2
- data/lib/fog/compute/requests/linode/avail_kernels.rb +6 -5
- data/lib/fog/compute/requests/linode/avail_linodeplans.rb +9 -3
- data/lib/fog/compute/requests/linode/avail_stackscripts.rb +3 -15
- data/lib/fog/compute/requests/linode/linode_boot.rb +15 -0
- data/lib/fog/compute/requests/linode/linode_config_create.rb +21 -0
- data/lib/fog/compute/requests/linode/linode_config_list.rb +18 -0
- data/lib/fog/compute/requests/linode/linode_create.rb +3 -4
- data/lib/fog/compute/requests/linode/linode_delete.rb +0 -1
- data/lib/fog/compute/requests/linode/linode_disk_create.rb +21 -0
- data/lib/fog/compute/requests/linode/linode_disk_createfromdistribution.rb +22 -0
- data/lib/fog/compute/requests/linode/linode_disk_createfromstackscript.rb +24 -0
- data/lib/fog/compute/requests/linode/linode_disk_delete.rb +19 -0
- data/lib/fog/compute/requests/linode/linode_disk_list.rb +19 -0
- data/lib/fog/compute/requests/linode/linode_ip_addprivate.rb +15 -0
- data/lib/fog/compute/requests/linode/linode_ip_list.rb +19 -0
- data/lib/fog/compute/requests/linode/linode_list.rb +0 -1
- data/lib/fog/compute/requests/linode/linode_reboot.rb +1 -2
- data/lib/fog/compute/requests/linode/linode_shutdown.rb +15 -0
- data/lib/fog/compute/requests/linode/linode_update.rb +15 -0
- data/lib/fog/compute/requests/linode/stackscript_list.rb +31 -0
- data/lib/fog/compute/requests/rackspace/confirm_resized_server.rb +3 -3
- data/lib/fog/compute/requests/rackspace/create_image.rb +2 -2
- data/lib/fog/compute/requests/rackspace/create_server.rb +2 -2
- data/lib/fog/compute/requests/rackspace/delete_image.rb +2 -2
- data/lib/fog/compute/requests/rackspace/delete_server.rb +2 -2
- data/lib/fog/compute/requests/rackspace/list_images_detail.rb +2 -2
- data/lib/fog/compute/requests/rackspace/list_servers_detail.rb +2 -2
- data/lib/fog/compute/requests/rackspace/resize_server.rb +4 -4
- data/lib/fog/compute/requests/rackspace/revert_resized_server.rb +4 -4
- data/lib/fog/compute/slicehost.rb +8 -2
- data/lib/fog/compute/storm_on_demand.rb +12 -1
- data/lib/fog/compute/voxel.rb +8 -2
- data/lib/fog/core/mock.rb +14 -1
- data/lib/fog/dns/aws.rb +8 -2
- data/lib/fog/dns/bluebox.rb +8 -2
- data/lib/fog/dns/dnsimple.rb +15 -3
- data/lib/fog/dns/linode.rb +8 -2
- data/lib/fog/dns/slicehost.rb +8 -2
- data/lib/fog/dns/zerigo.rb +8 -2
- data/lib/fog/providers/aws.rb +5 -10
- data/lib/fog/providers/linode.rb +0 -3
- data/lib/fog/storage.rb +6 -4
- data/lib/fog/storage/aws.rb +8 -2
- data/lib/fog/storage/google.rb +8 -2
- data/lib/fog/storage/local.rb +8 -2
- data/lib/fog/storage/models/aws/file.rb +0 -1
- data/lib/fog/storage/models/google/file.rb +1 -5
- data/lib/fog/storage/models/local/file.rb +1 -1
- data/lib/fog/storage/models/rackspace/file.rb +1 -5
- data/lib/fog/storage/rackspace.rb +8 -2
- data/lib/fog/storage/requests/aws/copy_object.rb +2 -2
- data/lib/fog/storage/requests/aws/delete_bucket.rb +3 -3
- data/lib/fog/storage/requests/aws/delete_object.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket_acl.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket_location.rb +1 -1
- data/lib/fog/storage/requests/aws/get_object.rb +1 -1
- data/lib/fog/storage/requests/aws/get_object_acl.rb +1 -1
- data/lib/fog/storage/requests/aws/get_request_payment.rb +1 -1
- data/lib/fog/storage/requests/aws/get_service.rb +1 -1
- data/lib/fog/storage/requests/aws/put_bucket.rb +3 -3
- data/lib/fog/storage/requests/aws/put_object.rb +3 -3
- data/lib/fog/storage/requests/aws/put_request_payment.rb +1 -1
- data/lib/fog/storage/requests/google/copy_object.rb +2 -2
- data/lib/fog/storage/requests/google/delete_bucket.rb +3 -3
- data/lib/fog/storage/requests/google/delete_object.rb +1 -1
- data/lib/fog/storage/requests/google/get_bucket.rb +1 -1
- data/lib/fog/storage/requests/google/get_bucket_acl.rb +1 -1
- data/lib/fog/storage/requests/google/get_object.rb +1 -1
- data/lib/fog/storage/requests/google/get_object_acl.rb +1 -1
- data/lib/fog/storage/requests/google/get_service.rb +2 -2
- data/lib/fog/storage/requests/google/put_bucket.rb +3 -3
- data/lib/fog/storage/requests/google/put_object.rb +3 -3
- data/lib/fog/terremark/requests/shared/get_network.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_organization.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_organizations.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_public_ips.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_vdc.rb +1 -1
- data/lib/fog/terremark/shared.rb +4 -0
- data/lib/fog/terremark/vcloud.rb +11 -1
- data/spec/ecloud/bin_spec.rb +8 -2
- data/spec/ecloud/spec_helper.rb +3 -3
- data/tests/compute/helper.rb +1 -3
- data/tests/compute/models/aws/server_tests.rb +3 -2
- data/tests/compute/requests/aws/instance_tests.rb +12 -9
- data/tests/compute/requests/aws/key_pair_tests.rb +1 -1
- data/tests/compute/requests/aws/volume_tests.rb +2 -2
- data/tests/compute/requests/brightbox/helper.rb +3 -0
- data/tests/compute/requests/linode/kernel_tests.rb +27 -0
- data/tests/compute/requests/linode/linode_tests.rb +62 -4
- data/tests/compute/requests/linode/stackscripts_tests.rb +35 -0
- data/tests/compute/requests/rackspace/resize_tests.rb +2 -2
- data/tests/compute/requests/voxel/server_tests.rb +1 -0
- data/tests/core/credential_tests.rb +7 -2
- data/tests/core/parser_tests.rb +1 -1
- data/tests/helper.rb +1 -1
- data/tests/helpers/compute/server_helper.rb +6 -0
- data/tests/helpers/formats_helper.rb +2 -0
- data/tests/helpers/mock_helper.rb +8 -1
- data/tests/helpers/model_helper.rb +1 -3
- data/tests/helpers/responds_to_helper.rb +2 -2
- data/tests/storage/helper.rb +1 -1
- data/tests/storage/models/directories_tests.rb +8 -4
- data/tests/storage/models/directory_test.rb +15 -11
- data/tests/storage/models/file_tests.rb +6 -6
- data/tests/storage/models/files_tests.rb +5 -5
- metadata +105 -55
@@ -56,6 +56,10 @@ module Fog
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
def self.reset
|
60
|
+
@data = nil
|
61
|
+
end
|
62
|
+
|
59
63
|
def self.reset_data(keys=data.keys)
|
60
64
|
for key in [*keys]
|
61
65
|
data.delete(key)
|
@@ -64,7 +68,14 @@ module Fog
|
|
64
68
|
|
65
69
|
def initialize(options={})
|
66
70
|
@storm_on_demand_username = options[:storm_on_demand_username]
|
67
|
-
|
71
|
+
end
|
72
|
+
|
73
|
+
def data
|
74
|
+
self.class.data[@storm_on_demand_username]
|
75
|
+
end
|
76
|
+
|
77
|
+
def reset_data
|
78
|
+
self.class.data.delete(@storm_on_demand_username)
|
68
79
|
end
|
69
80
|
|
70
81
|
end
|
data/lib/fog/compute/voxel.rb
CHANGED
@@ -48,14 +48,20 @@ module Fog
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def self.reset
|
52
|
+
@data = nil
|
53
|
+
end
|
54
|
+
|
51
55
|
def initialize(options={})
|
52
56
|
@voxel_api_key = options[:voxel_api_key]
|
53
|
-
|
57
|
+
end
|
58
|
+
|
59
|
+
def data
|
60
|
+
self.class.data[@voxel_api_key]
|
54
61
|
end
|
55
62
|
|
56
63
|
def reset_data
|
57
64
|
self.class.data.delete(@voxel_api_key)
|
58
|
-
@data = self.class.data[@voxel_api_key]
|
59
65
|
end
|
60
66
|
|
61
67
|
end
|
data/lib/fog/core/mock.rb
CHANGED
@@ -63,6 +63,19 @@ module Fog
|
|
63
63
|
selection
|
64
64
|
end
|
65
65
|
|
66
|
+
def self.reset
|
67
|
+
providers = Fog.providers.map {|p| Fog.const_get(p) }
|
68
|
+
possible_service_constants = providers.map {|p| p.constants.map {|c| p.const_get(c) } }.flatten
|
69
|
+
# c.to_sym is 1.8.7 / 1.9.2 compat
|
70
|
+
services = possible_service_constants.select {|s| s.constants.map {|c| c.to_sym }.include?(:Mock) }
|
71
|
+
service_mocks = services.map {|s| s.const_get(:Mock) }
|
72
|
+
|
73
|
+
service_mocks.each do |service_mock|
|
74
|
+
next unless service_mock.respond_to?(:reset)
|
75
|
+
service_mock.reset
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
66
79
|
end
|
67
80
|
|
68
|
-
end
|
81
|
+
end
|
data/lib/fog/dns/aws.rb
CHANGED
@@ -33,6 +33,10 @@ module Fog
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.reset
|
37
|
+
@data = nil
|
38
|
+
end
|
39
|
+
|
36
40
|
def initialize(options={})
|
37
41
|
unless options.delete(:provider)
|
38
42
|
location = caller.first
|
@@ -44,12 +48,14 @@ module Fog
|
|
44
48
|
require 'mime/types'
|
45
49
|
@aws_access_key_id = options[:aws_access_key_id]
|
46
50
|
@region = options[:region]
|
47
|
-
|
51
|
+
end
|
52
|
+
|
53
|
+
def data
|
54
|
+
self.class.data[@region][@aws_access_key_id]
|
48
55
|
end
|
49
56
|
|
50
57
|
def reset_data
|
51
58
|
self.class.data[@region].delete(@aws_access_key_id)
|
52
|
-
@data = self.class.data[@region][@aws_access_key_id]
|
53
59
|
end
|
54
60
|
|
55
61
|
def signature(params)
|
data/lib/fog/dns/bluebox.rb
CHANGED
@@ -30,6 +30,10 @@ module Fog
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.reset
|
34
|
+
@data = nil
|
35
|
+
end
|
36
|
+
|
33
37
|
def initialize(options={})
|
34
38
|
unless options.delete(:provider)
|
35
39
|
location = caller.first
|
@@ -40,12 +44,14 @@ module Fog
|
|
40
44
|
|
41
45
|
@bluebox_customer_id = options[:bluebox_customer_id]
|
42
46
|
@bluebox_api_key = options[:bluebox_api_key]
|
43
|
-
|
47
|
+
end
|
48
|
+
|
49
|
+
def data
|
50
|
+
self.class.data[@bluebox_customer_id]
|
44
51
|
end
|
45
52
|
|
46
53
|
def reset_data
|
47
54
|
self.class.data.delete(@bluebox_customer_id)
|
48
|
-
@data = self.class.data[@bluebox_customer_id]
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
data/lib/fog/dns/dnsimple.rb
CHANGED
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class DNS < Fog::Service
|
4
4
|
|
5
5
|
requires :dnsimple_email, :dnsimple_password
|
6
|
-
recognizes :host, :path, :port, :scheme, :persistent
|
6
|
+
recognizes :dnsimple_url, :host, :path, :port, :scheme, :persistent
|
7
7
|
recognizes :provider # remove post deprecation
|
8
8
|
|
9
9
|
model_path 'fog/dns/models/dnsimple'
|
@@ -31,6 +31,10 @@ module Fog
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def self.reset
|
35
|
+
@data = nil
|
36
|
+
end
|
37
|
+
|
34
38
|
def initialize(options={})
|
35
39
|
unless options.delete(:provider)
|
36
40
|
location = caller.first
|
@@ -41,12 +45,14 @@ module Fog
|
|
41
45
|
|
42
46
|
@dnsimple_email = options[:dnsimple_email]
|
43
47
|
@dnsimple_password = options[:dnsimple_password]
|
44
|
-
|
48
|
+
end
|
49
|
+
|
50
|
+
def data
|
51
|
+
self.class.data[@dnsimple_email]
|
45
52
|
end
|
46
53
|
|
47
54
|
def reset_data
|
48
55
|
self.class.data.delete(@dnsimple_email)
|
49
|
-
@data = self.class.data[@dnsimple_email]
|
50
56
|
end
|
51
57
|
|
52
58
|
end
|
@@ -65,6 +71,12 @@ module Fog
|
|
65
71
|
|
66
72
|
@dnsimple_email = options[:dnsimple_email]
|
67
73
|
@dnsimple_password = options[:dnsimple_password]
|
74
|
+
if options[:dnsimple_url]
|
75
|
+
uri = URI.parse(options[:dnsimple_url])
|
76
|
+
options[:host] = uri.host
|
77
|
+
options[:port] = uri.port
|
78
|
+
options[:scheme] = uri.scheme
|
79
|
+
end
|
68
80
|
@host = options[:host] || "dnsimple.com"
|
69
81
|
@port = options[:port] || 443
|
70
82
|
@scheme = options[:scheme] || 'https'
|
data/lib/fog/dns/linode.rb
CHANGED
@@ -30,6 +30,10 @@ module Fog
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.reset
|
34
|
+
@data = nil
|
35
|
+
end
|
36
|
+
|
33
37
|
def initialize(options={})
|
34
38
|
unless options.delete(:provider)
|
35
39
|
location = caller.first
|
@@ -39,12 +43,14 @@ module Fog
|
|
39
43
|
end
|
40
44
|
|
41
45
|
@linode_api_key = options[:linode_api_key]
|
42
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
def data
|
49
|
+
self.class.data[@linode_api_key]
|
43
50
|
end
|
44
51
|
|
45
52
|
def reset_data
|
46
53
|
self.class.data.delete(@linode_api_key)
|
47
|
-
@data = self.class.data[@linode_api_key]
|
48
54
|
end
|
49
55
|
|
50
56
|
end
|
data/lib/fog/dns/slicehost.rb
CHANGED
@@ -30,6 +30,10 @@ module Fog
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.reset
|
34
|
+
@data = nil
|
35
|
+
end
|
36
|
+
|
33
37
|
def initialize(options={})
|
34
38
|
unless options.delete(:provider)
|
35
39
|
location = caller.first
|
@@ -39,12 +43,14 @@ module Fog
|
|
39
43
|
end
|
40
44
|
|
41
45
|
@slicehost_password = options[:slicehost_password]
|
42
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
def data
|
49
|
+
self.class.data[@slicehost_password]
|
43
50
|
end
|
44
51
|
|
45
52
|
def reset_data
|
46
53
|
self.class.data.delete(@slicehost_password)
|
47
|
-
@data = self.class.data[@slicehost_password]
|
48
54
|
end
|
49
55
|
|
50
56
|
end
|
data/lib/fog/dns/zerigo.rb
CHANGED
@@ -36,6 +36,10 @@ module Fog
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
def self.reset
|
40
|
+
@data = nil
|
41
|
+
end
|
42
|
+
|
39
43
|
def initialize(options={})
|
40
44
|
unless options.delete(:provider)
|
41
45
|
location = caller.first
|
@@ -46,12 +50,14 @@ module Fog
|
|
46
50
|
|
47
51
|
@zerigo_email = options[:zerigo_email]
|
48
52
|
@zerigo_token = options[:zerigo_token]
|
49
|
-
|
53
|
+
end
|
54
|
+
|
55
|
+
def data
|
56
|
+
self.class.data[@zerigo_email]
|
50
57
|
end
|
51
58
|
|
52
59
|
def reset_data
|
53
60
|
self.class.data.delete(@zerigo_email)
|
54
|
-
@data = self.class.data[@zerigo_email]
|
55
61
|
end
|
56
62
|
|
57
63
|
end
|
data/lib/fog/providers/aws.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fog/core'
|
2
2
|
require 'fog/core/parser'
|
3
|
+
require 'openssl' # For RSA key pairs
|
3
4
|
|
4
5
|
module Fog
|
5
6
|
module AWS
|
@@ -44,7 +45,7 @@ module Fog
|
|
44
45
|
def self.escape(string)
|
45
46
|
string.gsub( /([^-a-zA-Z0-9_.~]+)/n ) { |match| '%' + match.unpack( 'H2' * match.size ).join( '%' ).upcase }
|
46
47
|
end
|
47
|
-
|
48
|
+
|
48
49
|
def self.signed_params(params, options = {})
|
49
50
|
params.merge!({
|
50
51
|
'AWSAccessKeyId' => options[:aws_access_key_id],
|
@@ -69,8 +70,8 @@ module Fog
|
|
69
70
|
|
70
71
|
class Mock
|
71
72
|
|
72
|
-
def self.availability_zone
|
73
|
-
"
|
73
|
+
def self.availability_zone(region)
|
74
|
+
"#{region}#{Fog::Mock.random_selection('abcd', 1)}"
|
74
75
|
end
|
75
76
|
|
76
77
|
def self.box_usage
|
@@ -140,13 +141,7 @@ module Fog
|
|
140
141
|
end
|
141
142
|
|
142
143
|
def self.key_material
|
143
|
-
|
144
|
-
20.times do
|
145
|
-
key_material << Fog::Mock.random_base64(76)
|
146
|
-
end
|
147
|
-
key_material << Fog::Mock.random_base64(67) + '='
|
148
|
-
key_material << '-----END RSA PRIVATE KEY-----'
|
149
|
-
key_material.join("\n")
|
144
|
+
OpenSSL::PKey::RSA.generate(1024).to_s
|
150
145
|
end
|
151
146
|
|
152
147
|
def self.owner_id
|
data/lib/fog/providers/linode.rb
CHANGED
data/lib/fog/storage.rb
CHANGED
@@ -22,12 +22,14 @@ module Fog
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.get_body_size(body)
|
25
|
-
|
26
|
-
|
25
|
+
if body.respond_to?(:force_encoding)
|
26
|
+
body.force_encoding('BINARY')
|
27
|
+
end
|
28
|
+
if body.respond_to?(:bytesize)
|
27
29
|
body.bytesize
|
28
|
-
|
30
|
+
elsif body.respond_to?(:size)
|
29
31
|
body.size
|
30
|
-
|
32
|
+
elsif body.respond_to?(:stat)
|
31
33
|
body.stat.size
|
32
34
|
else
|
33
35
|
0
|
data/lib/fog/storage/aws.rb
CHANGED
@@ -148,6 +148,10 @@ module Fog
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
+
def self.reset
|
152
|
+
@data = nil
|
153
|
+
end
|
154
|
+
|
151
155
|
def initialize(options={})
|
152
156
|
unless options.delete(:provider)
|
153
157
|
location = caller.first
|
@@ -175,12 +179,14 @@ module Fog
|
|
175
179
|
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
|
176
180
|
end
|
177
181
|
@region = options[:region]
|
178
|
-
|
182
|
+
end
|
183
|
+
|
184
|
+
def data
|
185
|
+
self.class.data[@region][@aws_access_key_id]
|
179
186
|
end
|
180
187
|
|
181
188
|
def reset_data
|
182
189
|
self.class.data[@region].delete(@aws_access_key_id)
|
183
|
-
@data = self.class.data[@region][@aws_access_key_id]
|
184
190
|
end
|
185
191
|
|
186
192
|
def signature(params)
|
data/lib/fog/storage/google.rb
CHANGED
@@ -119,6 +119,10 @@ module Fog
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
+
def self.reset
|
123
|
+
@data = nil
|
124
|
+
end
|
125
|
+
|
122
126
|
def initialize(options={})
|
123
127
|
unless options.delete(:provider)
|
124
128
|
location = caller.first
|
@@ -129,12 +133,14 @@ module Fog
|
|
129
133
|
|
130
134
|
require 'mime/types'
|
131
135
|
@google_storage_access_key_id = options[:google_storage_access_key_id]
|
132
|
-
|
136
|
+
end
|
137
|
+
|
138
|
+
def data
|
139
|
+
self.class.data[@google_storage_access_key_id]
|
133
140
|
end
|
134
141
|
|
135
142
|
def reset_data
|
136
143
|
self.class.data.delete(@google_storage_access_key_id)
|
137
|
-
@data = self.class.data[@google_storage_access_key_id]
|
138
144
|
end
|
139
145
|
|
140
146
|
def signature(params)
|
data/lib/fog/storage/local.rb
CHANGED
@@ -19,6 +19,10 @@ module Fog
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.reset
|
23
|
+
@data = nil
|
24
|
+
end
|
25
|
+
|
22
26
|
def initialize(options={})
|
23
27
|
Fog::Mock.not_implemented
|
24
28
|
|
@@ -31,7 +35,10 @@ module Fog
|
|
31
35
|
end
|
32
36
|
|
33
37
|
@local_root = ::File.expand_path(options[:local_root])
|
34
|
-
|
38
|
+
end
|
39
|
+
|
40
|
+
def data
|
41
|
+
self.class.data[@local_root]
|
35
42
|
end
|
36
43
|
|
37
44
|
def local_root
|
@@ -44,7 +51,6 @@ module Fog
|
|
44
51
|
|
45
52
|
def reset_data
|
46
53
|
self.class.data.delete(@local_root)
|
47
|
-
@data = self.class.data[@local_root]
|
48
54
|
end
|
49
55
|
|
50
56
|
end
|
@@ -117,7 +117,6 @@ module Fog
|
|
117
117
|
options['x-amz-storage-class'] = storage_class if storage_class
|
118
118
|
|
119
119
|
data = connection.put_object(directory.key, key, body, options)
|
120
|
-
data.headers.delete('Content-Length')
|
121
120
|
data.headers['ETag'].gsub!('"','')
|
122
121
|
merge_attributes(data.headers)
|
123
122
|
self.content_length = Fog::Storage.get_body_size(body)
|
@@ -119,11 +119,7 @@ module Fog
|
|
119
119
|
|
120
120
|
data = connection.put_object(directory.key, key, body, options)
|
121
121
|
merge_attributes(data.headers)
|
122
|
-
|
123
|
-
self.content_length = body.size
|
124
|
-
else
|
125
|
-
self.content_length = ::File.size(body.path)
|
126
|
-
end
|
122
|
+
self.content_length = Fog::Storage.get_body_size(body)
|
127
123
|
true
|
128
124
|
end
|
129
125
|
|