fog 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -6
- data/README.rdoc +7 -1
- data/bin/fog +4 -3
- data/fog.gemspec +39 -24
- data/lib/fog.rb +4 -12
- data/lib/fog/aws.rb +14 -5
- data/lib/fog/aws/compute.rb +26 -9
- data/lib/fog/aws/elb.rb +3 -2
- data/lib/fog/aws/models/compute/address.rb +2 -1
- data/lib/fog/aws/models/compute/addresses.rb +11 -9
- data/lib/fog/aws/models/compute/flavor.rb +1 -1
- data/lib/fog/aws/models/compute/flavors.rb +13 -11
- data/lib/fog/aws/models/compute/image.rb +2 -1
- data/lib/fog/aws/models/compute/images.rb +7 -9
- data/lib/fog/aws/models/compute/key_pair.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +10 -8
- data/lib/fog/aws/models/compute/security_group.rb +1 -1
- data/lib/fog/aws/models/compute/security_groups.rb +11 -9
- data/lib/fog/aws/models/compute/server.rb +10 -3
- data/lib/fog/aws/models/compute/servers.rb +14 -8
- data/lib/fog/aws/models/compute/snapshot.rb +3 -2
- data/lib/fog/aws/models/compute/snapshots.rb +11 -16
- data/lib/fog/aws/models/compute/tag.rb +36 -0
- data/lib/fog/aws/models/compute/tags.rb +34 -0
- data/lib/fog/aws/models/compute/volume.rb +11 -10
- data/lib/fog/aws/models/compute/volumes.rb +11 -9
- data/lib/fog/aws/models/storage/directories.rb +1 -1
- data/lib/fog/aws/models/storage/directory.rb +1 -1
- data/lib/fog/aws/models/storage/file.rb +3 -2
- data/lib/fog/aws/models/storage/files.rb +1 -7
- data/lib/fog/aws/parsers/compute/describe_availability_zones.rb +4 -2
- data/lib/fog/aws/parsers/compute/describe_images.rb +23 -13
- data/lib/fog/aws/parsers/compute/describe_instances.rb +34 -8
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +4 -3
- data/lib/fog/aws/parsers/compute/describe_snapshots.rb +33 -13
- data/lib/fog/aws/parsers/compute/describe_tags.rb +30 -0
- data/lib/fog/aws/parsers/compute/describe_volumes.rb +17 -3
- data/lib/fog/aws/parsers/compute/run_instances.rb +4 -4
- data/lib/fog/aws/parsers/storage/get_bucket.rb +1 -1
- data/lib/fog/aws/parsers/storage/get_bucket_logging.rb +1 -1
- data/lib/fog/aws/parsers/storage/get_bucket_object_versions.rb +3 -3
- data/lib/fog/aws/requests/compute/create_snapshot.rb +1 -0
- data/lib/fog/aws/requests/compute/create_tags.rb +78 -0
- data/lib/fog/aws/requests/compute/delete_tags.rb +45 -0
- data/lib/fog/aws/requests/compute/describe_addresses.rb +27 -19
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +31 -25
- data/lib/fog/aws/requests/compute/describe_images.rb +11 -18
- data/lib/fog/aws/requests/compute/describe_instances.rb +125 -53
- data/lib/fog/aws/requests/compute/describe_key_pairs.rb +29 -21
- data/lib/fog/aws/requests/compute/describe_regions.rb +28 -23
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +8 -4
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +48 -19
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +72 -35
- data/lib/fog/aws/requests/compute/describe_tags.rb +42 -0
- data/lib/fog/aws/requests/compute/describe_volumes.rb +67 -36
- data/lib/fog/aws/requests/compute/run_instances.rb +10 -3
- data/lib/fog/aws/simpledb.rb +3 -1
- data/lib/fog/aws/storage.rb +17 -8
- data/lib/fog/bluebox/models/compute/flavor.rb +1 -1
- data/lib/fog/bluebox/models/compute/flavors.rb +1 -1
- data/lib/fog/bluebox/models/compute/image.rb +1 -1
- data/lib/fog/bluebox/models/compute/images.rb +1 -1
- data/lib/fog/bluebox/models/compute/server.rb +8 -6
- data/lib/fog/bluebox/models/compute/servers.rb +1 -1
- data/lib/fog/bluebox/requests/compute/get_blocks.rb +1 -1
- data/lib/fog/core.rb +11 -0
- data/lib/fog/{attributes.rb → core/attributes.rb} +0 -0
- data/lib/fog/{bin.rb → core/bin.rb} +1 -1
- data/lib/fog/{collection.rb → core/collection.rb} +4 -0
- data/lib/fog/{connection.rb → core/connection.rb} +0 -0
- data/lib/fog/{credentials.rb → core/credentials.rb} +2 -0
- data/lib/fog/{deprecation.rb → core/deprecation.rb} +0 -0
- data/lib/fog/{errors.rb → core/errors.rb} +0 -0
- data/lib/fog/{hmac.rb → core/hmac.rb} +0 -0
- data/lib/fog/{model.rb → core/model.rb} +0 -0
- data/lib/fog/{parser.rb → core/parser.rb} +0 -0
- data/lib/fog/{provider.rb → core/provider.rb} +0 -0
- data/lib/fog/{service.rb → core/service.rb} +1 -0
- data/lib/fog/{ssh.rb → core/ssh.rb} +7 -7
- data/lib/fog/go_grid.rb +1 -1
- data/lib/fog/go_grid/compute.rb +6 -1
- data/lib/fog/go_grid/models/compute/image.rb +60 -0
- data/lib/fog/go_grid/models/compute/images.rb +33 -0
- data/lib/fog/go_grid/models/compute/server.rb +56 -0
- data/lib/fog/go_grid/models/compute/servers.rb +35 -0
- data/lib/fog/go_grid/requests/compute/grid_image_get.rb +41 -0
- data/lib/fog/go_grid/requests/compute/grid_image_list.rb +6 -1
- data/lib/fog/go_grid/requests/compute/grid_server_power.rb +2 -2
- data/lib/fog/google/models/storage/directories.rb +1 -1
- data/lib/fog/google/models/storage/directory.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +3 -2
- data/lib/fog/google/models/storage/files.rb +1 -7
- data/lib/fog/google/parsers/storage/get_bucket.rb +1 -1
- data/lib/fog/linode/requests/compute/avail_linodeplans.rb +2 -2
- data/lib/fog/local/models/storage/directories.rb +1 -1
- data/lib/fog/local/models/storage/directory.rb +1 -1
- data/lib/fog/local/models/storage/file.rb +2 -2
- data/lib/fog/local/models/storage/files.rb +2 -5
- data/lib/fog/local/storage.rb +1 -1
- data/lib/fog/new_servers/compute.rb +1 -1
- data/lib/fog/rackspace/models/compute/flavor.rb +1 -3
- data/lib/fog/rackspace/models/compute/flavors.rb +1 -1
- data/lib/fog/rackspace/models/compute/image.rb +2 -1
- data/lib/fog/rackspace/models/compute/images.rb +1 -1
- data/lib/fog/rackspace/models/compute/server.rb +12 -11
- data/lib/fog/rackspace/models/compute/servers.rb +1 -1
- data/lib/fog/rackspace/models/storage/directories.rb +1 -1
- data/lib/fog/rackspace/models/storage/directory.rb +1 -1
- data/lib/fog/rackspace/models/storage/file.rb +4 -4
- data/lib/fog/rackspace/models/storage/files.rb +1 -1
- data/lib/fog/rackspace/requests/compute/create_image.rb +2 -2
- data/lib/fog/rackspace/requests/compute/delete_image.rb +1 -1
- data/lib/fog/rackspace/requests/compute/delete_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute/get_server_details.rb +1 -1
- data/lib/fog/rackspace/requests/compute/list_addresses.rb +1 -1
- data/lib/fog/rackspace/requests/compute/list_images_detail.rb +2 -2
- data/lib/fog/rackspace/requests/compute/list_private_addresses.rb +1 -1
- data/lib/fog/rackspace/requests/compute/list_public_addresses.rb +1 -1
- data/lib/fog/rackspace/requests/compute/update_server.rb +1 -1
- data/lib/fog/rackspace/requests/storage/put_object.rb +4 -3
- data/lib/fog/slicehost/models/compute/flavor.rb +1 -1
- data/lib/fog/slicehost/models/compute/flavors.rb +1 -1
- data/lib/fog/slicehost/models/compute/image.rb +1 -1
- data/lib/fog/slicehost/models/compute/images.rb +1 -1
- data/lib/fog/slicehost/models/compute/server.rb +3 -1
- data/lib/fog/slicehost/models/compute/servers.rb +1 -1
- data/lib/fog/terremark/ecloud.rb +34 -33
- data/lib/fog/terremark/models/shared/address.rb +1 -1
- data/lib/fog/terremark/models/shared/network.rb +1 -1
- data/lib/fog/terremark/models/shared/server.rb +1 -1
- data/lib/fog/terremark/models/shared/servers.rb +1 -1
- data/lib/fog/terremark/models/shared/task.rb +1 -1
- data/lib/fog/terremark/models/shared/tasks.rb +1 -1
- data/lib/fog/terremark/models/shared/vdc.rb +1 -1
- data/lib/fog/terremark/parser.rb +1 -0
- data/lib/fog/terremark/vcloud.rb +4 -4
- data/lib/fog/vcloud.rb +15 -7
- data/lib/fog/vcloud/terremark/ecloud.rb +15 -3
- data/lib/fog/vcloud/terremark/ecloud/models/firewall_acls.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +55 -49
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +19 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +8 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +17 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +29 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +38 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +8 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb +46 -4
- data/spec/aws/models/compute/server_spec.rb +2 -0
- data/spec/aws/requests/simpledb/select_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/vcloud/spec_helper.rb +1 -1
- data/spec/vcloud/terremark/ecloud/requests/get_catalog_item_spec.rb +62 -0
- data/spec/vcloud/terremark/ecloud/requests/get_catalog_spec.rb +44 -0
- data/spec/vcloud/terremark/ecloud/requests/get_customization_options_spec.rb +39 -0
- data/spec/vcloud/terremark/ecloud/requests/instantiate_vapp_template_spec.rb +73 -0
- data/tests/aws/requests/compute/address_tests.rb +2 -6
- data/tests/aws/requests/compute/availability_zone_tests.rb +3 -10
- data/tests/aws/requests/compute/image_tests.rb +4 -9
- data/tests/aws/requests/compute/instance_tests.rb +7 -8
- data/tests/aws/requests/compute/key_pair_tests.rb +2 -6
- data/tests/aws/requests/compute/region_tests.rb +2 -9
- data/tests/aws/requests/compute/security_group_tests.rb +3 -7
- data/tests/aws/requests/compute/snapshot_tests.rb +4 -7
- data/tests/aws/requests/compute/tag_tests.rb +49 -0
- data/tests/aws/requests/compute/volume_tests.rb +2 -6
- data/tests/aws/requests/storage/bucket_tests.rb +48 -0
- data/tests/aws/requests/storage/object_tests.rb +63 -0
- data/tests/bluebox/requests/compute/block_tests.rb +24 -11
- data/tests/bluebox/requests/compute/product_tests.rb +3 -0
- data/tests/bluebox/requests/compute/template_tests.rb +3 -0
- data/tests/go_grid/helper.rb +0 -0
- data/tests/go_grid/requests/compute/image_tests.rb +0 -0
- data/tests/helper.rb +5 -1
- data/tests/linode/requests/compute/datacenter_tests.rb +1 -0
- data/tests/linode/requests/compute/distribution_tests.rb +2 -0
- data/tests/linode/requests/compute/linode_tests.rb +6 -0
- data/tests/linode/requests/compute/linodeplans_tests.rb +2 -0
- data/tests/lorem.txt +1 -0
- data/tests/rackspace/requests/compute/flavor_tests.rb +4 -0
- data/tests/rackspace/requests/compute/image_tests.rb +12 -4
- data/tests/rackspace/requests/compute/server_tests.rb +9 -0
- data/tests/slicehost/requests/compute/backup_tests.rb +1 -0
- data/tests/slicehost/requests/compute/flavor_tests.rb +3 -0
- data/tests/slicehost/requests/compute/image_tests.rb +3 -0
- data/tests/slicehost/requests/compute/slice_tests.rb +14 -2
- metadata +42 -27
- data/spec/aws/requests/storage/delete_bucket_spec.rb +0 -35
- data/spec/aws/requests/storage/delete_object_spec.rb +0 -36
- data/spec/aws/requests/storage/get_object_spec.rb +0 -58
- data/spec/aws/requests/storage/get_service_spec.rb +0 -32
- data/spec/aws/requests/storage/head_object_spec.rb +0 -26
- data/spec/aws/requests/storage/put_bucket_spec.rb +0 -19
- data/spec/aws/requests/storage/put_object_spec.rb +0 -43
@@ -13,7 +13,7 @@ module Fog
|
|
13
13
|
# * response<~Excon::Response>:
|
14
14
|
# * body<~Array>:
|
15
15
|
# TODO: docs
|
16
|
-
def
|
16
|
+
def grid_server_power(server, power)
|
17
17
|
request(
|
18
18
|
:path => 'grid/server/power',
|
19
19
|
:query => {'server' => server}
|
@@ -24,7 +24,7 @@ module Fog
|
|
24
24
|
|
25
25
|
class Mock
|
26
26
|
|
27
|
-
def
|
27
|
+
def grid_server_power(server)
|
28
28
|
Fog::Mock.not_implemented
|
29
29
|
end
|
30
30
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/model'
|
1
|
+
require 'fog/core/model'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Google
|
@@ -8,7 +8,7 @@ module Fog
|
|
8
8
|
|
9
9
|
identity :key, :aliases => 'Key'
|
10
10
|
|
11
|
-
|
11
|
+
attr_writer :body
|
12
12
|
attribute :content_length, :aliases => 'Content-Length'
|
13
13
|
attribute :content_type, :aliases => 'Content-Type'
|
14
14
|
attribute :etag, :aliases => ['Etag', 'ETag']
|
@@ -53,6 +53,7 @@ module Fog
|
|
53
53
|
true
|
54
54
|
end
|
55
55
|
|
56
|
+
remove_method :owner=
|
56
57
|
def owner=(new_owner)
|
57
58
|
if new_owner
|
58
59
|
@owner = {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/collection'
|
1
|
+
require 'fog/core/collection'
|
2
2
|
require 'fog/google/models/storage/file'
|
3
3
|
|
4
4
|
module Fog
|
@@ -81,12 +81,6 @@ module Fog
|
|
81
81
|
super({ :directory => directory }.merge!(attributes))
|
82
82
|
end
|
83
83
|
|
84
|
-
private
|
85
|
-
|
86
|
-
def directory=(new_directory)
|
87
|
-
@directory = new_directory
|
88
|
-
end
|
89
|
-
|
90
84
|
end
|
91
85
|
|
92
86
|
end
|
@@ -9,7 +9,7 @@ module Fog
|
|
9
9
|
# * response<~Excon::Response>:
|
10
10
|
# * body<~Array>:
|
11
11
|
# TODO: docs
|
12
|
-
def avail_linodeplans(linodeplan_id=nil)
|
12
|
+
def avail_linodeplans(linodeplan_id = nil)
|
13
13
|
options = {}
|
14
14
|
if linodeplan_id
|
15
15
|
options.merge!(:planId => linodeplan_id)
|
@@ -25,7 +25,7 @@ module Fog
|
|
25
25
|
|
26
26
|
class Mock
|
27
27
|
|
28
|
-
def avail_linodeplans
|
28
|
+
def avail_linodeplans(linodeplan_id = nil)
|
29
29
|
Fog::Mock.not_implemented
|
30
30
|
end
|
31
31
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/model'
|
1
|
+
require 'fog/core/model'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Local
|
@@ -8,7 +8,7 @@ module Fog
|
|
8
8
|
|
9
9
|
identity :key, :aliases => 'Key'
|
10
10
|
|
11
|
-
|
11
|
+
attr_writer :body
|
12
12
|
attribute :content_length, :aliases => 'Content-Length'
|
13
13
|
# attribute :content_type, :aliases => 'Content-Type'
|
14
14
|
attribute :last_modified, :aliases => 'Last-Modified'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/collection'
|
1
|
+
require 'fog/core/collection'
|
2
2
|
require 'fog/local/models/storage/file'
|
3
3
|
|
4
4
|
module Fog
|
@@ -45,10 +45,7 @@ module Fog
|
|
45
45
|
file.close
|
46
46
|
new(data)
|
47
47
|
else
|
48
|
-
body =
|
49
|
-
::File.open(path) do |file|
|
50
|
-
body = file.read
|
51
|
-
end
|
48
|
+
body = ::File.read(path)
|
52
49
|
new(data.merge!(:body => body))
|
53
50
|
end
|
54
51
|
else
|
data/lib/fog/local/storage.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/model'
|
1
|
+
require 'fog/core/model'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Rackspace
|
@@ -33,6 +33,7 @@ module Fog
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def save
|
36
|
+
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
36
37
|
requires :server_id
|
37
38
|
|
38
39
|
data = connection.create_image(@server_id, 'name' => name)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/model'
|
1
|
+
require 'fog/core/model'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Rackspace
|
@@ -47,16 +47,6 @@ module Fog
|
|
47
47
|
connection.images(:server => self)
|
48
48
|
end
|
49
49
|
|
50
|
-
def ready?
|
51
|
-
@status == 'ACTIVE'
|
52
|
-
end
|
53
|
-
|
54
|
-
def reboot(type = 'SOFT')
|
55
|
-
requires :id
|
56
|
-
connection.reboot_server(@id, type)
|
57
|
-
true
|
58
|
-
end
|
59
|
-
|
60
50
|
def private_key_path
|
61
51
|
File.expand_path(@private_key_path ||= Fog.credentials[:private_key_path])
|
62
52
|
end
|
@@ -73,7 +63,18 @@ module Fog
|
|
73
63
|
@public_key ||= File.read(public_key_path)
|
74
64
|
end
|
75
65
|
|
66
|
+
def ready?
|
67
|
+
@status == 'ACTIVE'
|
68
|
+
end
|
69
|
+
|
70
|
+
def reboot(type = 'SOFT')
|
71
|
+
requires :id
|
72
|
+
connection.reboot_server(@id, type)
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
76
76
|
def save
|
77
|
+
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
77
78
|
requires :flavor_id, :image_id, :name
|
78
79
|
options = {
|
79
80
|
'metadata' => @metadata,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/model'
|
1
|
+
require 'fog/core/model'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Rackspace
|
@@ -8,7 +8,7 @@ module Fog
|
|
8
8
|
|
9
9
|
identity :key, :aliases => 'Key'
|
10
10
|
|
11
|
-
|
11
|
+
attr_writer :body
|
12
12
|
attribute :content_length, :aliases => 'Content-Length'
|
13
13
|
attribute :content_type, :aliases => 'Content-Type'
|
14
14
|
attribute :etag, :aliases => 'Etag'
|
@@ -41,9 +41,9 @@ module Fog
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def save
|
44
|
+
def save(options = {})
|
45
45
|
requires :body, :directory, :key
|
46
|
-
data = connection.put_object(directory.name, @key, @body)
|
46
|
+
data = connection.put_object(directory.name, @key, @body, options)
|
47
47
|
@etag = data.headers['ETag']
|
48
48
|
true
|
49
49
|
end
|
@@ -47,12 +47,12 @@ module Fog
|
|
47
47
|
'name' => options['name'] || '',
|
48
48
|
'serverId' => server_id,
|
49
49
|
'status' => 'SAVING',
|
50
|
-
'updated' => now,
|
50
|
+
'updated' => now.to_s,
|
51
51
|
}
|
52
52
|
|
53
53
|
@data[:last_modified][:images][data['id']] = now
|
54
54
|
@data[:images][data['id']] = data
|
55
|
-
response.body = { 'image' => data.reject {|key, value| !['id', 'name', 'serverId'].include?(key)} }
|
55
|
+
response.body = { 'image' => data.reject {|key, value| !['id', 'name', 'serverId', 'status', 'updated'].include?(key)} }
|
56
56
|
response
|
57
57
|
end
|
58
58
|
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
|
23
23
|
def delete_image(image_id)
|
24
24
|
response = Excon::Response.new
|
25
|
-
if image = list_images_detail.body['images'].detect {|
|
25
|
+
if image = list_images_detail.body['images'].detect {|_| _['id'] == image_id}
|
26
26
|
if image['status'] == 'SAVING'
|
27
27
|
response.status = 409
|
28
28
|
raise(Excon::Errors.status_error({:expects => 202}, response))
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
|
23
23
|
def delete_server(server_id)
|
24
24
|
response = Excon::Response.new
|
25
|
-
if server = list_servers_detail.body['servers'].detect {
|
25
|
+
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
26
26
|
if server['status'] == 'BUILD'
|
27
27
|
response.status = 409
|
28
28
|
raise(Excon::Errors.status_error({:expects => 202}, response))
|
@@ -37,7 +37,7 @@ module Fog
|
|
37
37
|
|
38
38
|
def get_server_details(server_id)
|
39
39
|
response = Excon::Response.new
|
40
|
-
if server = list_servers_detail.body['servers'].detect {
|
40
|
+
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
41
41
|
response.status = [200, 203][rand(1)]
|
42
42
|
response.body = { 'server' => server }
|
43
43
|
response
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
|
29
29
|
def list_addresses(server_id)
|
30
30
|
response = Excon::Response.new
|
31
|
-
if server = list_servers_detail.body['servers'].detect {
|
31
|
+
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
32
32
|
response.status = [200, 203][rand(1)]
|
33
33
|
response.body = { 'addresses' => server['addresses'] }
|
34
34
|
response
|
@@ -32,14 +32,14 @@ module Fog
|
|
32
32
|
for image in images
|
33
33
|
case image['status']
|
34
34
|
when 'SAVING'
|
35
|
-
if Time.now - @data[:last_modified][:images][image['id']] >
|
35
|
+
if Time.now - @data[:last_modified][:images][image['id']] > Fog::Mock.delay
|
36
36
|
image['status'] = 'ACTIVE'
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
response.status = [200, 203][rand(1)]
|
42
|
-
response.body = { 'images' => images }
|
42
|
+
response.body = { 'images' => images.map {|image| image.reject {|key, value| !['id', 'name', 'status', 'updated'].include?(key)}} }
|
43
43
|
response
|
44
44
|
end
|
45
45
|
|
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
|
27
27
|
def list_private_addresses(server_id)
|
28
28
|
response = Excon::Response.new
|
29
|
-
if server = list_servers_detail.body['servers'].detect {
|
29
|
+
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
30
30
|
response.status = [200, 203][rand(1)]
|
31
31
|
response.body = { 'private' => server['addresses']['private'] }
|
32
32
|
response
|
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
|
27
27
|
def list_public_addresses(server_id)
|
28
28
|
response = Excon::Response.new
|
29
|
-
if server = list_servers_detail.body['servers'].detect {
|
29
|
+
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
30
30
|
response.status = [200, 203][rand(1)]
|
31
31
|
response.body = { 'public' => server['addresses']['public'] }
|
32
32
|
response
|
@@ -25,7 +25,7 @@ module Fog
|
|
25
25
|
|
26
26
|
def update_server(server_id, options)
|
27
27
|
response = Excon::Response.new
|
28
|
-
if server = list_servers_detail.body['servers'].detect {
|
28
|
+
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
29
29
|
if options['adminPass']
|
30
30
|
server['adminPass'] = options['adminPass']
|
31
31
|
end
|
@@ -8,12 +8,13 @@ module Fog
|
|
8
8
|
# ==== Parameters
|
9
9
|
# * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
10
10
|
#
|
11
|
-
def put_object(container, object, data)
|
11
|
+
def put_object(container, object, data, options = {})
|
12
12
|
data = parse_data(data)
|
13
|
+
headers = data[:headers].merge!(options)
|
13
14
|
response = storage_request(
|
14
15
|
:body => data[:body],
|
15
16
|
:expects => 201,
|
16
|
-
:headers =>
|
17
|
+
:headers => headers,
|
17
18
|
:method => 'PUT',
|
18
19
|
:path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
|
19
20
|
)
|
@@ -24,7 +25,7 @@ module Fog
|
|
24
25
|
|
25
26
|
class Mock
|
26
27
|
|
27
|
-
def put_object(container, object, data)
|
28
|
+
def put_object(container, object, data, options = {})
|
28
29
|
Fog::Mock.not_implemented
|
29
30
|
end
|
30
31
|
|