fog 1.0.0 → 1.1.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/README.rdoc +2 -9
- data/Rakefile +3 -2
- data/docs/_layouts/default.html +13 -13
- data/docs/about/contributing.markdown +1 -1
- data/docs/about/getting_started.markdown +28 -3
- data/docs/dns/index.markdown +4 -4
- data/docs/index.markdown +2 -10
- data/docs/public/css/fog.css +14 -1
- data/docs/storage/index.markdown +2 -2
- data/fog.gemspec +6 -5
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +26 -1
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +3 -0
- data/lib/fog/aws/cloud_watch.rb +17 -1
- data/lib/fog/aws/compute.rb +50 -18
- data/lib/fog/aws/elb.rb +4 -2
- data/lib/fog/aws/emr.rb +133 -0
- data/lib/fog/aws/models/cloud_watch/alarm.rb +12 -0
- data/lib/fog/aws/models/cloud_watch/alarm_data.rb +39 -0
- data/lib/fog/aws/models/cloud_watch/alarm_datum.rb +66 -0
- data/lib/fog/aws/models/cloud_watch/alarm_histories.rb +18 -0
- data/lib/fog/aws/models/cloud_watch/alarm_history.rb +16 -0
- data/lib/fog/aws/models/cloud_watch/alarms.rb +30 -0
- data/lib/fog/aws/models/compute/addresses.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +1 -1
- data/lib/fog/aws/models/compute/security_groups.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +4 -2
- data/lib/fog/aws/models/compute/servers.rb +1 -1
- data/lib/fog/aws/models/compute/snapshots.rb +1 -1
- data/lib/fog/aws/models/compute/spot_request.rb +21 -4
- data/lib/fog/aws/models/compute/spot_requests.rb +45 -1
- data/lib/fog/aws/models/compute/volumes.rb +1 -1
- data/lib/fog/aws/models/elb/load_balancer.rb +2 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
- data/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
- data/lib/fog/aws/parsers/cloud_watch/delete_alarms.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb +40 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +73 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +71 -0
- data/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/get_metric_statistics.rb +1 -0
- data/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb +26 -0
- data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -2
- data/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
- data/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
- data/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
- data/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
- data/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
- data/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
- data/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
- data/lib/fog/aws/rds.rb +3 -1
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
- data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarm_history.rb +33 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +38 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb +39 -0
- data/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +84 -0
- data/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb +31 -0
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
- data/lib/fog/aws/requests/compute/create_snapshot.rb +2 -3
- data/lib/fog/aws/requests/compute/create_tags.rb +5 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +0 -1
- data/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
- data/lib/fog/aws/requests/compute/delete_tags.rb +3 -4
- data/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
- data/lib/fog/aws/requests/compute/describe_images.rb +6 -9
- data/lib/fog/aws/requests/compute/describe_instances.rb +17 -8
- data/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +7 -5
- data/lib/fog/aws/requests/compute/describe_volumes.rb +5 -4
- data/lib/fog/aws/requests/compute/modify_image_attribute.rb +32 -0
- data/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
- data/lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb +1 -1
- data/lib/fog/aws/requests/compute/register_image.rb +0 -1
- data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
- data/lib/fog/aws/requests/compute/run_instances.rb +1 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/create_load_balancer_listeners.rb +1 -1
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +2 -2
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
- data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +2 -2
- data/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
- data/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
- data/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
- data/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
- data/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
- data/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
- data/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
- data/lib/fog/aws/requests/iam/get_server_certificate.rb +5 -7
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/select.rb +1 -1
- data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
- data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/hash_to_acl.rb +35 -25
- data/lib/fog/aws/ses.rb +1 -1
- data/lib/fog/aws/simpledb.rb +2 -0
- data/lib/fog/aws/sns.rb +3 -1
- data/lib/fog/aws/sqs.rb +4 -2
- data/lib/fog/aws/storage.rb +12 -3
- data/lib/fog/bin.rb +1 -1
- data/lib/fog/bin/aws.rb +8 -4
- data/lib/fog/bin/bluebox.rb +2 -2
- data/lib/fog/bin/brightbox.rb +1 -1
- data/lib/fog/bin/dnsimple.rb +1 -1
- data/lib/fog/bin/dnsmadeeasy.rb +1 -1
- data/lib/fog/bin/ecloud.rb +1 -1
- data/lib/fog/bin/glesys.rb +1 -1
- data/lib/fog/bin/go_grid.rb +1 -1
- data/lib/fog/bin/google.rb +1 -1
- data/lib/fog/bin/libvirt.rb +1 -1
- data/lib/fog/bin/linode.rb +2 -2
- data/lib/fog/bin/local.rb +1 -1
- data/lib/fog/bin/new_servers.rb +1 -1
- data/lib/fog/bin/ninefold.rb +2 -2
- data/lib/fog/bin/openstack.rb +1 -1
- data/lib/fog/bin/rackspace.rb +3 -3
- data/lib/fog/bin/slicehost.rb +1 -1
- data/lib/fog/bin/stormondemand.rb +1 -1
- data/lib/fog/bin/virtual_box.rb +1 -1
- data/lib/fog/bin/vmfusion.rb +1 -1
- data/lib/fog/bin/voxel.rb +1 -1
- data/lib/fog/bin/zerigo.rb +1 -1
- data/lib/fog/brightbox/models/compute/account.rb +1 -1
- data/lib/fog/compute/models/server.rb +1 -2
- data/lib/fog/core/attributes.rb +5 -5
- data/lib/fog/core/connection.rb +1 -1
- data/lib/fog/core/deprecation.rb +2 -2
- data/lib/fog/core/logger.rb +8 -3
- data/lib/fog/core/mock.rb +4 -0
- data/lib/fog/core/provider.rb +7 -2
- data/lib/fog/core/service.rb +8 -2
- data/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
- data/lib/fog/dynect/dns.rb +25 -3
- data/lib/fog/ecloud/compute.rb +2 -6
- data/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +1 -1
- data/lib/fog/google/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/libvirt/models/compute/uri.rb +7 -3
- data/lib/fog/linode/models/compute/server.rb +10 -0
- data/lib/fog/ninefold/models/storage/file.rb +8 -6
- data/lib/fog/ninefold/models/storage/files.rb +3 -2
- data/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
- data/lib/fog/ninefold/storage.rb +4 -2
- data/lib/fog/openstack.rb +4 -3
- data/lib/fog/openstack/compute.rb +8 -5
- data/lib/fog/openstack/models/compute/server.rb +10 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +6 -8
- data/lib/fog/rackspace/load_balancers.rb +1 -0
- data/lib/fog/rackspace/models/dns/callback.rb +1 -1
- data/lib/fog/rackspace/models/dns/record.rb +1 -1
- data/lib/fog/rackspace/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/dns.rb +1 -0
- data/lib/fog/slicehost/models/dns/record.rb +7 -3
- data/lib/fog/slicehost/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
- data/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
- data/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
- data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
- data/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
- data/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
- data/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
- data/lib/fog/terremark/vcloud.rb +1 -1
- data/lib/fog/vsphere/compute.rb +40 -23
- data/lib/fog/vsphere/models/compute/server.rb +1 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +36 -4
- data/lib/fog/zerigo/dns.rb +14 -3
- data/lib/fog/zerigo/models/dns/record.rb +1 -1
- data/lib/fog/zerigo/models/dns/records.rb +5 -0
- data/lib/fog/zerigo/models/dns/zones.rb +2 -2
- data/lib/fog/zerigo/requests/dns/count_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/count_zones.rb +12 -1
- data/lib/fog/zerigo/requests/dns/create_host.rb +67 -1
- data/lib/fog/zerigo/requests/dns/create_zone.rb +44 -1
- data/lib/fog/zerigo/requests/dns/delete_host.rb +19 -0
- data/lib/fog/zerigo/requests/dns/delete_zone.rb +17 -0
- data/lib/fog/zerigo/requests/dns/find_hosts.rb +22 -1
- data/lib/fog/zerigo/requests/dns/get_host.rb +18 -1
- data/lib/fog/zerigo/requests/dns/get_zone.rb +19 -2
- data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +23 -0
- data/lib/fog/zerigo/requests/dns/list_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/list_zones.rb +15 -0
- data/lib/fog/zerigo/requests/dns/update_host.rb +20 -1
- data/lib/fog/zerigo/requests/dns/update_zone.rb +20 -1
- data/tests/aws/models/cloud_watch/alarm_data_tests.rb +42 -0
- data/tests/aws/models/cloud_watch/alarm_history_tests.rb +22 -0
- data/tests/aws/models/compute/security_group_tests.rb +15 -10
- data/tests/aws/models/elb/model_tests.rb +4 -4
- data/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
- data/tests/aws/requests/cloud_watch/list_metrics_test.rb +5 -5
- data/tests/aws/requests/compute/image_tests.rb +33 -2
- data/tests/aws/requests/compute/instance_tests.rb +16 -1
- data/tests/aws/requests/compute/security_group_tests.rb +251 -32
- data/tests/aws/requests/compute/tag_tests.rb +42 -2
- data/tests/aws/requests/emr/helper.rb +172 -0
- data/tests/aws/requests/emr/instance_group_tests.rb +106 -0
- data/tests/aws/requests/emr/job_flow_tests.rb +88 -0
- data/tests/aws/requests/iam/server_certificate_tests.rb +20 -7
- data/tests/aws/requests/storage/bucket_tests.rb +82 -54
- data/tests/aws/requests/storage/hash_to_acl_tests.rb +173 -0
- data/tests/aws/requests/storage/object_tests.rb +44 -24
- data/tests/brightbox/requests/compute/helper.rb +15 -6
- data/tests/core/attribute_tests.rb +29 -0
- data/tests/core/mocking_tests.rb +60 -0
- data/tests/dns/models/record_tests.rb +4 -2
- data/tests/dns/models/records_tests.rb +4 -2
- data/tests/dns/models/zone_tests.rb +3 -1
- data/tests/dns/models/zones_tests.rb +4 -2
- data/tests/helper.rb +4 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +16 -12
- data/tests/rackspace/requests/dns/records_tests.rb +13 -11
- data/tests/slicehost/requests/dns/dns_tests.rb +58 -11
- data/tests/vsphere/compute_tests.rb +18 -10
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +1 -1
- metadata +214 -221
|
@@ -58,11 +58,12 @@ module Fog
|
|
|
58
58
|
|
|
59
59
|
if id.nil?
|
|
60
60
|
data = connection.create_record(zone.domain, name, type, value, options).body
|
|
61
|
+
merge_attributes(data)
|
|
61
62
|
else
|
|
62
|
-
|
|
63
|
+
options.merge!(:name => name, :type => type, :data => value)
|
|
64
|
+
connection.update_record(zone.domain, id, options).body
|
|
63
65
|
end
|
|
64
66
|
|
|
65
|
-
merge_attributes(data)
|
|
66
67
|
true
|
|
67
68
|
end
|
|
68
69
|
|
data/lib/fog/dynect/dns.rb
CHANGED
|
@@ -26,6 +26,8 @@ module Fog
|
|
|
26
26
|
request :post_zone
|
|
27
27
|
request :put_zone
|
|
28
28
|
|
|
29
|
+
class JobIncomplete < Error; end
|
|
30
|
+
|
|
29
31
|
class Mock
|
|
30
32
|
def initialize(options={})
|
|
31
33
|
@dynect_customer = options[:dynect_customer]
|
|
@@ -80,18 +82,23 @@ module Fog
|
|
|
80
82
|
|
|
81
83
|
def request(params)
|
|
82
84
|
begin
|
|
85
|
+
# any request could redirect to a job
|
|
86
|
+
params[:expects] = Array(params[:expects]) | [307]
|
|
87
|
+
|
|
83
88
|
params[:headers] ||= {}
|
|
84
89
|
params[:headers]['Content-Type'] = 'application/json'
|
|
85
90
|
params[:headers]['API-Version'] = @version
|
|
86
91
|
params[:headers]['Auth-Token'] = auth_token unless params[:path] == "Session"
|
|
87
|
-
params[:path] = "#{@path}/#{params[:path]}"
|
|
92
|
+
params[:path] = "#{@path}/#{params[:path]}" unless params[:path] =~ %r{^#{Regexp.escape(@path)}/}
|
|
88
93
|
response = @connection.request(params.merge!({:host => @host}))
|
|
89
94
|
|
|
90
|
-
|
|
95
|
+
if response.status == 307
|
|
96
|
+
response = poll_job(response)
|
|
97
|
+
elsif !response.body.empty?
|
|
91
98
|
response.body = MultiJson.decode(response.body)
|
|
92
99
|
end
|
|
93
|
-
response
|
|
94
100
|
|
|
101
|
+
response
|
|
95
102
|
rescue Excon::Errors::HTTPStatusError => error
|
|
96
103
|
if @auth_token && error.message =~ /login: (Bad or expired credentials|inactivity logout)/
|
|
97
104
|
@auth_token = nil
|
|
@@ -103,6 +110,21 @@ module Fog
|
|
|
103
110
|
|
|
104
111
|
response
|
|
105
112
|
end
|
|
113
|
+
|
|
114
|
+
def poll_job(response, time_to_wait = 10)
|
|
115
|
+
job_location = response.headers['Location']
|
|
116
|
+
|
|
117
|
+
Fog.wait_for(time_to_wait) do
|
|
118
|
+
response = request(:expects => 200, :method => :get, :path => job_location)
|
|
119
|
+
response.body['status'] != 'incomplete'
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if response.body['status'] == 'incomplete'
|
|
123
|
+
raise JobIncomplete.new("Job #{response.body['job_id']} is still incomplete")
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
response
|
|
127
|
+
end
|
|
106
128
|
end
|
|
107
129
|
|
|
108
130
|
end
|
data/lib/fog/ecloud/compute.rb
CHANGED
|
@@ -18,11 +18,7 @@ module Fog
|
|
|
18
18
|
|
|
19
19
|
def check_href!(opts = {})
|
|
20
20
|
unless href
|
|
21
|
-
if opts.is_a?(String)
|
|
22
|
-
t = Hash.new
|
|
23
|
-
t[:parent] = opts
|
|
24
|
-
opts = t
|
|
25
|
-
end
|
|
21
|
+
opts = { :parent => opts } if opts.is_a?(String)
|
|
26
22
|
msg = ":href missing, call with a :href pointing to #{if opts[:message]
|
|
27
23
|
opts[:message]
|
|
28
24
|
elsif opts[:parent]
|
|
@@ -1065,7 +1061,7 @@ module Fog
|
|
|
1065
1061
|
end
|
|
1066
1062
|
|
|
1067
1063
|
def self.data_reset
|
|
1068
|
-
Fog::Logger.
|
|
1064
|
+
Fog::Logger.deprecation("#{self} => #data_reset is deprecated, use #reset instead [light_black](#{caller.first})[/]")
|
|
1069
1065
|
self.reset
|
|
1070
1066
|
end
|
|
1071
1067
|
|
|
@@ -106,7 +106,7 @@ module Fog
|
|
|
106
106
|
def save(options = {})
|
|
107
107
|
requires :body, :directory, :key
|
|
108
108
|
if options != {}
|
|
109
|
-
Fog::Logger.
|
|
109
|
+
Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
|
|
110
110
|
end
|
|
111
111
|
options['x-goog-acl'] ||= @acl if @acl
|
|
112
112
|
options['Cache-Control'] = cache_control if cache_control
|
|
@@ -18,7 +18,7 @@ module Fog
|
|
|
18
18
|
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html
|
|
19
19
|
|
|
20
20
|
def get_object_url(bucket_name, object_name, expires)
|
|
21
|
-
Fog::Logger.
|
|
21
|
+
Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
|
|
22
22
|
get_object_https_url(bucket_name, object_name, expires)
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ module Fog
|
|
|
27
27
|
class Mock # :nodoc:all
|
|
28
28
|
|
|
29
29
|
def get_object_url(bucket_name, object_name, expires)
|
|
30
|
-
Fog::Logger.
|
|
30
|
+
Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
|
|
31
31
|
get_object_https_url(bucket_name, object_name, expires)
|
|
32
32
|
end
|
|
33
33
|
|
data/lib/fog/google/storage.rb
CHANGED
|
@@ -45,7 +45,7 @@ module Fog
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def url(params, expires)
|
|
48
|
-
Fog::Logger.
|
|
48
|
+
Fog::Logger.deprecation("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
|
|
49
49
|
https_url(params, expires)
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -126,9 +126,13 @@ module Fog
|
|
|
126
126
|
# http://libvirt.org/remote.html
|
|
127
127
|
private
|
|
128
128
|
def value(name)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
unless @parsed_uri.query.nil?
|
|
130
|
+
params=CGI.parse(@parsed_uri.query)
|
|
131
|
+
if params.has_key?(name)
|
|
132
|
+
return params[name].first
|
|
133
|
+
else
|
|
134
|
+
return nil
|
|
135
|
+
end
|
|
132
136
|
else
|
|
133
137
|
return nil
|
|
134
138
|
end
|
|
@@ -5,14 +5,24 @@ module Fog
|
|
|
5
5
|
class Linode
|
|
6
6
|
class Server < Fog::Compute::Server
|
|
7
7
|
attr_reader :stack_script
|
|
8
|
+
attr_accessor :private_key, :username
|
|
8
9
|
identity :id
|
|
9
10
|
attribute :name
|
|
10
11
|
attribute :status
|
|
11
12
|
|
|
13
|
+
def initialize(attributes={})
|
|
14
|
+
super
|
|
15
|
+
self.username = 'root'
|
|
16
|
+
end
|
|
17
|
+
|
|
12
18
|
def ips
|
|
13
19
|
Fog::Compute::Linode::Ips.new :server => self, :connection => connection
|
|
14
20
|
end
|
|
15
21
|
|
|
22
|
+
def public_ip_address
|
|
23
|
+
ips.find{|ip| ip.ip !~ /^192/}.ip
|
|
24
|
+
end
|
|
25
|
+
|
|
16
26
|
def disks
|
|
17
27
|
Fog::Compute::Linode::Disks.new :server => self, :connection => connection
|
|
18
28
|
end
|
|
@@ -13,7 +13,7 @@ module Fog
|
|
|
13
13
|
attribute :objectid, :aliases => :ObjectID
|
|
14
14
|
|
|
15
15
|
def body
|
|
16
|
-
attributes[:body] ||= if
|
|
16
|
+
attributes[:body] ||= if objectid
|
|
17
17
|
collection.get(identity).body
|
|
18
18
|
else
|
|
19
19
|
''
|
|
@@ -73,13 +73,15 @@ module Fog
|
|
|
73
73
|
options[:headers] ||= {}
|
|
74
74
|
options[:headers]['Content-Type'] = content_type if content_type
|
|
75
75
|
options[:body] = body
|
|
76
|
-
|
|
77
|
-
# pre-existing file, do a PUT
|
|
78
|
-
data = connection.put_namespace(ns, options)
|
|
79
|
-
else
|
|
80
|
-
# new file, POST
|
|
76
|
+
begin
|
|
81
77
|
data = connection.post_namespace(ns, options)
|
|
82
78
|
self.objectid = data.headers['location'].split('/')[-1]
|
|
79
|
+
rescue => error
|
|
80
|
+
if error.message =~ /The resource you are trying to create already exists./
|
|
81
|
+
data = connection.put_namespace(ns, options)
|
|
82
|
+
else
|
|
83
|
+
raise error
|
|
84
|
+
end
|
|
83
85
|
end
|
|
84
86
|
# merge_attributes(data.headers)
|
|
85
87
|
true
|
|
@@ -51,12 +51,13 @@ module Fog
|
|
|
51
51
|
|
|
52
52
|
def head(key, options = {})
|
|
53
53
|
requires :directory
|
|
54
|
-
data = connection.
|
|
54
|
+
data = connection.head_namespace(directory.key + key, :parse => false)
|
|
55
55
|
file_data = data.headers.merge({
|
|
56
|
+
:body => data.body,
|
|
56
57
|
:key => key
|
|
57
58
|
})
|
|
58
59
|
new(file_data)
|
|
59
|
-
rescue Fog::Storage::
|
|
60
|
+
rescue Fog::Storage::Ninefold::NotFound
|
|
60
61
|
nil
|
|
61
62
|
end
|
|
62
63
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Storage
|
|
3
|
+
class Ninefold
|
|
4
|
+
class Real
|
|
5
|
+
|
|
6
|
+
def head_namespace(namespace = '', options = {})
|
|
7
|
+
options = options.reject {|key, value| value.nil?}
|
|
8
|
+
request({
|
|
9
|
+
:expects => 200,
|
|
10
|
+
:method => 'HEAD',
|
|
11
|
+
:path => "namespace/" + namespace,
|
|
12
|
+
:query => {},
|
|
13
|
+
:parse => true
|
|
14
|
+
}.merge(options))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/fog/ninefold/storage.rb
CHANGED
|
@@ -20,6 +20,7 @@ module Fog
|
|
|
20
20
|
request_path 'fog/ninefold/requests/storage'
|
|
21
21
|
# request :delete_container
|
|
22
22
|
request :get_namespace
|
|
23
|
+
request :head_namespace
|
|
23
24
|
request :post_namespace
|
|
24
25
|
request :put_namespace
|
|
25
26
|
request :delete_namespace
|
|
@@ -107,9 +108,10 @@ module Fog
|
|
|
107
108
|
|
|
108
109
|
customheaders = {}
|
|
109
110
|
params[:headers].each { |key,value|
|
|
110
|
-
|
|
111
|
+
case key
|
|
112
|
+
when 'x-emc-date', 'x-emc-signature'
|
|
111
113
|
#skip
|
|
112
|
-
|
|
114
|
+
when /^x-emc-/
|
|
113
115
|
customheaders[ key.downcase ] = value
|
|
114
116
|
end
|
|
115
117
|
}
|
data/lib/fog/openstack.rb
CHANGED
|
@@ -88,12 +88,13 @@ module Fog
|
|
|
88
88
|
|
|
89
89
|
response = connection.request({
|
|
90
90
|
:expects => [200, 204],
|
|
91
|
-
:
|
|
91
|
+
:headers => {'Content-Type' => 'application/json'},
|
|
92
|
+
:body => MultiJson.encode(req_body),
|
|
92
93
|
:host => uri.host,
|
|
93
|
-
:method => '
|
|
94
|
+
:method => 'POST',
|
|
94
95
|
:path => (uri.path and not uri.path.empty?) ? uri.path : 'v2.0'
|
|
95
96
|
})
|
|
96
|
-
body=response.body
|
|
97
|
+
body=MultiJson.decode(response.body)
|
|
97
98
|
|
|
98
99
|
if body['auth']['serviceCatalog'] and body['auth']['serviceCatalog'][@compute_service_name] and body['auth']['serviceCatalog'][@compute_service_name][0] then
|
|
99
100
|
mgmt_url = body['auth']['serviceCatalog'][@compute_service_name][0]['publicURL']
|
|
@@ -6,8 +6,8 @@ module Fog
|
|
|
6
6
|
module Compute
|
|
7
7
|
class OpenStack < Fog::Service
|
|
8
8
|
|
|
9
|
-
requires :openstack_api_key, :openstack_username, :openstack_auth_url
|
|
10
|
-
recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_compute_service_name
|
|
9
|
+
requires :openstack_api_key, :openstack_username, :openstack_auth_url
|
|
10
|
+
recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_compute_service_name, :openstack_tenant
|
|
11
11
|
|
|
12
12
|
model_path 'fog/openstack/models/compute'
|
|
13
13
|
model :flavor
|
|
@@ -167,7 +167,7 @@ module Fog
|
|
|
167
167
|
:openstack_tenant => @openstack_tenant,
|
|
168
168
|
:openstack_compute_service_name => @openstack_compute_service_name
|
|
169
169
|
}
|
|
170
|
-
if @openstack_auth_url =~
|
|
170
|
+
if @openstack_auth_url =~ /\/v2.0\//
|
|
171
171
|
credentials = Fog::OpenStack.authenticate_v2(options, @connection_options)
|
|
172
172
|
else
|
|
173
173
|
credentials = Fog::OpenStack.authenticate_v1(options, @connection_options)
|
|
@@ -181,8 +181,11 @@ module Fog
|
|
|
181
181
|
end
|
|
182
182
|
@host = uri.host
|
|
183
183
|
@path = uri.path
|
|
184
|
-
|
|
185
|
-
@path.
|
|
184
|
+
@path.sub!(/\/$/, '')
|
|
185
|
+
unless @path.match(/1\.1/)
|
|
186
|
+
raise Fog::Compute::OpenStack::ServiceUnavailable.new(
|
|
187
|
+
"OpenStack binding only supports version 1.1")
|
|
188
|
+
end
|
|
186
189
|
# Add tenant
|
|
187
190
|
@path += @openstack_tenant if @openstack_tenant
|
|
188
191
|
@port = uri.port
|
|
@@ -20,6 +20,8 @@ module Fog
|
|
|
20
20
|
attribute :progress
|
|
21
21
|
attribute :accessIPv4
|
|
22
22
|
attribute :accessIPv6
|
|
23
|
+
attribute :availability_zone
|
|
24
|
+
attribute :user_data_encoded
|
|
23
25
|
attribute :state, :aliases => 'status'
|
|
24
26
|
|
|
25
27
|
attr_reader :password
|
|
@@ -27,6 +29,7 @@ module Fog
|
|
|
27
29
|
|
|
28
30
|
def initialize(attributes={})
|
|
29
31
|
@connection = attributes[:connection]
|
|
32
|
+
attributes[:metadata] = {}
|
|
30
33
|
super
|
|
31
34
|
end
|
|
32
35
|
|
|
@@ -45,6 +48,10 @@ module Fog
|
|
|
45
48
|
metadata.load(metas)
|
|
46
49
|
end
|
|
47
50
|
|
|
51
|
+
def user_data=(ascii_userdata)
|
|
52
|
+
self.user_data_encoded = [ascii_userdata].pack('m')
|
|
53
|
+
end
|
|
54
|
+
|
|
48
55
|
def destroy
|
|
49
56
|
requires :id
|
|
50
57
|
connection.delete_server(id)
|
|
@@ -152,7 +159,9 @@ module Fog
|
|
|
152
159
|
'metadata' => meta_hash,
|
|
153
160
|
'personality' => personality,
|
|
154
161
|
'accessIPv4' => accessIPv4,
|
|
155
|
-
'accessIPv6' => accessIPv6
|
|
162
|
+
'accessIPv6' => accessIPv6,
|
|
163
|
+
'availability_zone' => availability_zone,
|
|
164
|
+
'user_data' => user_data_encoded
|
|
156
165
|
}
|
|
157
166
|
options = options.reject {|key, value| value.nil?}
|
|
158
167
|
data = connection.create_server(name, image_ref, flavor_ref, options)
|
|
@@ -12,15 +12,12 @@ module Fog
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
data['server']['accessIPv4'] = options['accessIPv4']
|
|
20
|
-
end
|
|
21
|
-
if options['accessIPv6']
|
|
22
|
-
data['server']['accessIPv6'] = options['accessIPv6']
|
|
15
|
+
vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6',
|
|
16
|
+
'availability_zone', 'user_data']
|
|
17
|
+
vanilla_options.select{|o| options[o]}.each do |key|
|
|
18
|
+
data['server'][key] = options[key]
|
|
23
19
|
end
|
|
20
|
+
|
|
24
21
|
if options['personality']
|
|
25
22
|
data['server']['personality'] = []
|
|
26
23
|
for file in options['personality']
|
|
@@ -30,6 +27,7 @@ module Fog
|
|
|
30
27
|
}
|
|
31
28
|
end
|
|
32
29
|
end
|
|
30
|
+
|
|
33
31
|
request(
|
|
34
32
|
:body => MultiJson.encode(data),
|
|
35
33
|
:expects => [200, 202],
|
|
@@ -11,7 +11,7 @@ module Fog
|
|
|
11
11
|
response = nil
|
|
12
12
|
Fog.wait_for(timeout, interval) do
|
|
13
13
|
response = connection.callback job_id
|
|
14
|
-
if response.status !=
|
|
14
|
+
if response.body['status'] != 'RUNNING'
|
|
15
15
|
true
|
|
16
16
|
elsif retries == 0
|
|
17
17
|
raise Fog::Errors::Error.new("Wait on job #{job_id} took too long")
|
|
@@ -51,7 +51,7 @@ module Fog
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
response = wait_for_job connection.add_records(@zone.identity, [options]).body['jobId']
|
|
54
|
-
merge_attributes(response.body['records'].first)
|
|
54
|
+
merge_attributes(response.body['response']['records'].select {|record| record['name'] == self.name && record['type'] == self.type && record['data'] == self.value}.first)
|
|
55
55
|
true
|
|
56
56
|
end
|
|
57
57
|
|
|
@@ -52,7 +52,7 @@ module Fog
|
|
|
52
52
|
response = connection.create_domains([data])
|
|
53
53
|
|
|
54
54
|
response = wait_for_job response.body['jobId']
|
|
55
|
-
merge_attributes(response.body['domains'].first)
|
|
55
|
+
merge_attributes(response.body['response']['domains'].select {|domain| domain['name'] == self.domain}.first)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def update
|
data/lib/fog/slicehost/dns.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Fog
|
|
|
12
12
|
identity :id
|
|
13
13
|
|
|
14
14
|
attribute :active
|
|
15
|
-
attribute :value, :aliases => 'ip'
|
|
15
|
+
attribute :value, :aliases => ['ip', 'data']
|
|
16
16
|
attribute :name
|
|
17
17
|
attribute :description, :aliases => 'aux'
|
|
18
18
|
attribute :ttl
|
|
@@ -45,13 +45,17 @@ module Fog
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def save
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
requires :name, :type, :value, :zone
|
|
50
50
|
options = {}
|
|
51
51
|
options[:active] = active ? 'Y' : 'N'
|
|
52
52
|
options[:aux] = description if description
|
|
53
53
|
options[:ttl] = ttl if ttl
|
|
54
|
-
|
|
54
|
+
if identity
|
|
55
|
+
data = connection.update_record(identity, type, zone.id, name, value, options)
|
|
56
|
+
else
|
|
57
|
+
data = connection.create_record(type, zone.id, name, value, options)
|
|
58
|
+
end
|
|
55
59
|
merge_attributes(data.body)
|
|
56
60
|
true
|
|
57
61
|
end
|