1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge branch 'master' of github.com:geemus/fog

This commit is contained in:
Dylan Egan 2011-10-22 10:08:50 -07:00
commit 16040a0bc6
75 changed files with 286 additions and 123 deletions

View file

@ -39,28 +39,28 @@
</dl>
</header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about/structure.html">Structure</a></li>
<li><a href="/about/getting_started.html">Getting Started</a></li>
<li>&nbsp;</li>
<li><a href="/storage">Storage</a></li>
<li><a href="/compute">Compute</a></li>
<li><a href="/dns">DNS</a></li>
<li><a href="/cdn">CDN</a></li>
</ul>
</nav>
<div id="main">
{{ content }}
<h2>Services</h2>
<ul>
<li><a href="/cdn">CDN</a></li>
<li><a href="/compute">Compute</a></li>
<li><a href="/dns">DNS</a></li>
<li><a href="/storage">Storage</a></li>
{% for post in site.posts %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
<h2>About</h2>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about/contributing.html">Contributing</a></li>
<li><a href="/about/getting_started.html">Getting Started</a></li>
<li><a href="/about/press.html">Press</a></li>
<li><a href="/about/structure.html">Structure</a></li>
<li><a href="/about/supported_services.html">Supported Services</a></li>
<li><a href="/about/users.html">Users</a></li>
</ul>

View file

@ -56,7 +56,7 @@ header dl dt {
font-weight: bold;
}
#main {
nav, #main {
background-color: #FFF;
-moz-border-radius: 0.5em;
border-radius: 0.5em;
@ -66,6 +66,19 @@ header dl dt {
margin-bottom: 2em;
}
nav {
padding: 1em;
}
nav li {
display: inline;
padding-left: 2em;
}
nav li a {
font-size: 1.5em;
}
footer {
background-color: #A0C0E1;
border-color: #70A1D2;

View file

@ -37,7 +37,7 @@ Gem::Specification.new do |s|
## List your runtime dependencies here. Runtime dependencies are those
## that are needed for an end user to actually USE your code.
s.add_dependency('builder')
s.add_dependency('excon', '~>0.7.3')
s.add_dependency('excon', '~>0.7.4')
s.add_dependency('formatador', '~>0.2.0')
s.add_dependency('multi_json', '~>1.0.3')
s.add_dependency('mime-types')

View file

@ -9,6 +9,7 @@ module Fog
request_path 'fog/aws/requests/cloud_formation'
request :create_stack
request :update_stack
request :delete_stack
request :describe_stack_events
request :describe_stack_resources

View file

@ -93,7 +93,7 @@ module Fog
class Real
def modify_image_attributes(*params)
Fog::Logger.warning("modify_image_attributes is deprecated, use modify_image_attribute instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("modify_image_attributes is deprecated, use modify_image_attribute instead [light_black](#{caller.first})[/]")
modify_image_attribute(*params)
end

View file

@ -56,7 +56,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('public-ip' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('public-ip' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end
self.filters = filters

View file

@ -51,7 +51,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('key-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('key-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'key-name' => [*filters]}
end
self.filters = filters

View file

@ -57,7 +57,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('group-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('group-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'group-name' => [*filters]}
end
self.filters = filters

View file

@ -170,6 +170,8 @@ module Fog
merge_attributes(data.body['instancesSet'].first)
if self.tags
# expect eventual consistency
Fog.wait_for { self.reload rescue nil }
for key, value in self.tags
connection.tags.create(
:key => key,

View file

@ -57,7 +57,7 @@ module Fog
def all(filters = self.filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('instance-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end
self.filters = filters

View file

@ -19,7 +19,7 @@ module Fog
def all(filters = filters, options = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'snapshot-id' => [*filters]}
end
self.filters = filters

View file

@ -17,7 +17,7 @@ module Fog
def all(filters = self.filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'spot-instance-request-id' => [*filters]}
end
self.filters = filters

View file

@ -64,7 +64,7 @@ module Fog
def all(filters = filters)
unless filters.is_a?(Hash)
Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('volume-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('volume-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'volume-id' => [*filters]}
end
self.filters = filters

View file

@ -104,7 +104,7 @@ module Fog
def save(options = {})
requires :body, :directory, :key
if options != {}
Fog::Logger.warning("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
end
options['x-amz-acl'] ||= @acl if @acl
options['Cache-Control'] = cache_control if cache_control

View file

@ -0,0 +1,19 @@
module Fog
module Parsers
module AWS
module CloudFormation
class UpdateStack < Fog::Parsers::Base
def end_element(name)
case name
when 'RequestId', 'StackId'
@response[name] = value
end
end
end
end
end
end
end

View file

@ -17,6 +17,8 @@ module Fog
# * NotificationARNs<~Array>: List of SNS topics to publish events to
# * Parameters<~Hash>: Hash of providers to supply to template
# * TimeoutInMinutes<~Integer>: Minutes to wait before status is set to CREATE_FAILED
# * Capabilities<~Array>: List of capabilties the stack is granted. Currently CAPABILITY_IAM
# for allowing the creation of IAM resources
#
# ==== Returns
# * response<~Excon::Response>:
@ -58,6 +60,10 @@ module Fog
if options['TimeoutInMinutes']
params['TimeoutInMinutes'] = options['TimeoutInMinutes']
end
if options['Capabilities']
params.merge!(Fog::AWS.indexed_param("Capabilities.member", [*options['Capabilities']]))
end
request({
'Action' => 'CreateStack',

View file

@ -0,0 +1,62 @@
module Fog
module AWS
class CloudFormation
class Real
require 'fog/aws/parsers/cloud_formation/update_stack'
# Update a stack
#
# ==== Parameters
# * stack_name<~String>: name of the stack to update
# * options<~Hash>:
# * TemplateBody<~String>: structure containing the template body
# or (one of the two Template parameters is required)
# * TemplateURL<~String>: URL of file containing the template body
# * Parameters<~Hash>: Hash of providers to supply to template
# * Capabilities<~Array>: List of capabilties the stack is granted. Currently CAPABILITY_IAM
# for allowing the creation of IAM resources
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'StackId'<~String> - Id of the stack being updated
#
# ==== See Also
# http://docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_UpdateStack.html
#
def update_stack(stack_name, options = {})
params = {
'StackName' => stack_name,
}
if options['Parameters']
options['Parameters'].keys.each_with_index do |key, index|
index += 1 # params are 1-indexed
params.merge!({
"Parameters.member.#{index}.ParameterKey" => key,
"Parameters.member.#{index}.ParameterValue" => options['Parameters'][key]
})
end
end
if options['TemplateBody']
params['TemplateBody'] = options['TemplateBody']
elsif options['TemplateURL']
params['TemplateURL'] = options['TemplateURL']
end
if options['Capabilities']
params.merge!(Fog::AWS.indexed_param("Capabilities.member", [*options['Capabilities']]))
end
request({
'Action' => 'UpdateStack',
:parser => Fog::Parsers::AWS::CloudFormation::UpdateStack.new
}.merge!(params))
end
end
end
end
end

View file

@ -28,7 +28,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html]
def authorize_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end
@ -46,7 +46,7 @@ module Fog
def authorize_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end

View file

@ -21,7 +21,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAddresses.html]
def describe_addresses(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -38,7 +38,7 @@ module Fog
def describe_addresses(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end

View file

@ -22,7 +22,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html]
def describe_availability_zones(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -39,7 +39,7 @@ module Fog
def describe_availability_zones(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'public-ip' => [*filters]}
end

View file

@ -60,7 +60,7 @@ module Fog
def describe_images(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_images with #{filters.class} param is deprecated, use describe_images('image-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_images with #{filters.class} param is deprecated, use describe_images('image-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'image-id' => [*filters]}
end

View file

@ -55,7 +55,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html]
def describe_instances(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end
params = {}
@ -81,7 +81,7 @@ module Fog
def describe_instances(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end
@ -154,16 +154,25 @@ module Fog
end
end
brand_new_instances = instance_set.find_all do |instance|
instance['instanceState']['name'] == 'pending' &&
Time.now - instance['launchTime'] < Fog::Mock.delay * 2
end
# Error if filtering for a brand new instance directly
if (filters['instance-id'] || filters['instanceId']) && !brand_new_instances.empty?
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{brand_new_instances.first['instanceId']}' does not exist")
end
# Otherwise don't include it in the list
instance_set = instance_set.reject {|instance| brand_new_instances.include?(instance) }
response.status = 200
reservation_set = {}
instance_set.each do |instance|
case instance['instanceState']['name']
when 'pending'
if Time.now - instance['launchTime'] < Fog::Mock.delay * 2
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance['instanceId']}' does not exist")
end
if Time.now - instance['launchTime'] >= Fog::Mock.delay * 2
instance['ipAddress'] = Fog::AWS::Mock.ip_address
instance['originalIpAddress'] = instance['ipAddress']

View file

@ -21,7 +21,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html]
def describe_key_pairs(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'key-name' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -38,7 +38,7 @@ module Fog
def describe_key_pairs(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'key-name' => [*filters]}
end

View file

@ -21,7 +21,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRegions.html]
def describe_regions(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'region-name' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -38,7 +38,7 @@ module Fog
def describe_regions(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'region-name' => [*filters]}
end

View file

@ -29,7 +29,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstances.html]
def describe_reserved_instances(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'reserved-instances-id' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)

View file

@ -31,7 +31,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html]
def describe_security_groups(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'group-name' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -48,7 +48,7 @@ module Fog
def describe_security_groups(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'group-name' => [*filters]}
end

View file

@ -27,11 +27,11 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html]
def describe_snapshots(filters = {}, options = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'snapshot-id' => [*filters]}
end
unless options.empty?
Fog::Logger.warning("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
end
for key in ['ExecutableBy', 'ImageId', 'Owner', 'RestorableBy']
@ -54,11 +54,11 @@ module Fog
def describe_snapshots(filters = {}, options = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'snapshot-id' => [*filters]}
end
unless options.empty?
Fog::Logger.warning("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
end
response = Excon::Response.new

View file

@ -31,7 +31,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVolumes.html]
def describe_volumes(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'volume-id' => [*filters]}
end
params = Fog::AWS.indexed_filters(filters)
@ -48,7 +48,7 @@ module Fog
def describe_volumes(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.warning("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'volume-id' => [*filters]}
end

View file

@ -34,7 +34,7 @@ module Fog
end
def modify_instance_attributes(instance_id, attributes)
Fog::Logger.warning("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
Fog::Logger.deprecation("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
modify_instance_attribute(instance_id, attributes)
end

View file

@ -27,7 +27,7 @@ module Fog
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html]
def revoke_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end
@ -45,7 +45,7 @@ module Fog
def revoke_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
Fog::Logger.warning("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
options = group_name
group_name = options['GroupName']
end

View file

@ -29,7 +29,7 @@ module Fog
# * 'RequestId'
def get_attributes(domain_name, item_name, options = {})
if options.is_a?(Array)
Fog::Logger.warning("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
options = {'AttributeName' => options}
end
options['AttributeName'] ||= []
@ -49,7 +49,7 @@ module Fog
def get_attributes(domain_name, item_name, options = {})
if options.is_a?(Array)
Fog::Logger.warning("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
options['AttributeName'] ||= options if options.is_a?(Array)
end
options['AttributeName'] ||= []

View file

@ -23,7 +23,7 @@ module Fog
# * 'NextToken'<~String> - offset to start with if there are are more domains to list
def select(select_expression, options = {})
if options.is_a?(String)
Fog::Logger.warning("get_attributes with string next_token param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("get_attributes with string next_token param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
options = {'NextToken' => options}
end
options['NextToken'] ||= nil

View file

@ -18,7 +18,7 @@ module Fog
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
get_object_https_url(bucket_name, object_name, expires)
end
@ -27,7 +27,7 @@ module Fog
class Mock # :nodoc:all
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead [light_black](#{caller.first})[/]")
get_object_https_url(bucket_name, object_name, expires)
end

View file

@ -5,7 +5,7 @@ module Fog
class SNS < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :host, :path, :port, :scheme, :persistent
recognizes :host, :path, :port, :scheme, :persistent, :region
request_path 'fog/aws/requests/sns'
request :add_permission

View file

@ -76,7 +76,7 @@ module Fog
end
def url(params, expires)
Fog::Logger.warning("Fog::Storage::AWS => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::AWS => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
https_url(params, expires)
end
@ -229,7 +229,8 @@ module Fog
# :aws_secret_access_key in order to create a connection
#
# ==== Examples
# s3 = S3.new(
# s3 = Fog::Storage.new(
# :provider => "AWS",
# :aws_access_key_id => your_aws_access_key_id,
# :aws_secret_access_key => your_aws_secret_access_key
# )

View file

@ -4,7 +4,7 @@ module Fog
class << self
def available_providers
@available_providers ||= @providers.select {|provider| Kernel.const_get(provider).available?}.sort
@available_providers ||= Fog.providers.values.select {|provider| Kernel.const_get(provider).available?}.sort
end
end

View file

@ -47,17 +47,17 @@ class AWS < Fog::Bin
when :auto_scaling
Fog::AWS::AutoScaling.new
when :cdn
Fog::Logger.warning("AWS[:cdn] is deprecated, use CDN[:aws] instead")
Fog::Logger.warning("AWS[:cdn] is not recommended, use CDN[:aws] for portability")
Fog::CDN.new(:provider => 'AWS')
when :cloud_formation
Fog::AWS::CloudFormation.new
when :cloud_watch
Fog::AWS::CloudWatch.new
when :compute
Fog::Logger.warning("AWS[:compute] is deprecated, use Compute[:aws] instead")
Fog::Logger.warning("AWS[:compute] is not recommended, use Comptue[:aws] for portability")
Fog::Compute.new(:provider => 'AWS')
when :dns
Fog::Logger.warning("AWS[:dns] is deprecated, use DNS[:aws] instead")
Fog::Logger.warning("AWS[:dns] is not recommended, use DNS[:aws] for portability")
Fog::DNS.new(:provider => 'AWS')
when :elasticache
Fog::AWS::Elasticache.new
@ -76,7 +76,7 @@ class AWS < Fog::Bin
when :sqs
Fog::AWS::SQS.new
when :storage
Fog::Logger.warning("AWS[:storage] is deprecated, use Storage[:aws] instead")
Fog::Logger.warning("AWS[:storage] is not recommended, use Storage[:aws] for portability")
Fog::Storage.new(:provider => 'AWS')
when :sns
Fog::AWS::SNS.new

View file

@ -16,10 +16,10 @@ class Bluebox < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Bluebox[:compute] is deprecated, use Compute[:bluebox] instead")
Fog::Logger.warning("Bluebox[:compute] is not recommended, use Compute[:bluebox] for portability")
Fog::Compute.new(:provider => 'Bluebox')
when :dns
Fog::Logger.warning("Bluebox[:storage] is deprecated, use Storage[:bluebox] instead")
Fog::Logger.warning("Bluebox[:dns] is not recommended, use DNS[:bluebox] for portability")
Fog::DNS.new(:provider => 'Bluebox')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

@ -14,7 +14,7 @@ class Brightbox < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Brightbox[:compute] is deprecated, use Compute[:brightbox] instead")
Fog::Logger.warning("Brightbox[:compute] is not recommended, use Compute[:brightbox] for portability")
Fog::Compute.new(:provider => 'Brightbox')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class DNSimple < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::Logger.warning("DNSimple[:dns] is deprecated, use Storage[:dnsimple] instead")
Fog::Logger.warning("DNSimple[:dns] is not recommended, use DNS[:dnsimple] for portability")
Fog::DNS.new(:provider => 'DNSimple')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class DNSMadeEasy < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::Logger.warning("DNSMadeEasy[:dns] is deprecated, use Storage[:dnsmadeeasy] instead")
Fog::Logger.warning("DNSMadeEasy[:dns] is not recommended, use DNS[:dnsmadeeasy] for portability")
Fog::DNS.new(:provider => 'DNSMadeEasy')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Ecloud < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Ecloud[:compute] is deprecated, use Compute[:ecloud] instead")
Fog::Logger.warning("Ecloud[:compute] is not recommended, use Compute[:ecloud] for portability")
Fog::Compute.new(:provider => 'Ecloud')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Glesys < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Glesys[:compute] is deprecated, use Compute[:glesys] instead[/]")
Fog::Logger.warning("Glesys[:compute] is not recommended, use Compute[:glesys] for portability")
Fog::Compute.new(:provider => 'Glesys')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

@ -14,7 +14,7 @@ class GoGrid < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("GoGrid[:compute] is deprecated, use Compute[:gogrid] instead")
Fog::Logger.warning("GoGrid[:compute] is not recommended, use Compute[:gogrid] for portability")
Fog::Compute.new(:provider => 'GoGrid')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Google < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :storage
Fog::Logger.warning("Google[:storage] is deprecated, use Storage[:google] instead")
Fog::Logger.warning("Google[:storage] is not recommended, use Storage[:google] for portability")
Fog::Storage.new(:provider => 'Google')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ module Libvirt # deviates from other bin stuff to accomodate gem
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Libvirt[:compute] is deprecated, use Compute[:libvirt] instead")
Fog::Logger.warning("Libvirt[:compute] is not recommended, use Compute[:libvirt] for portability")
Fog::Compute.new(:provider => 'Libvirt')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -16,10 +16,10 @@ class Linode < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Linode[:compute] is deprecated, use Compute[:linode] instead")
Fog::Logger.warning("Linode[:compute] is not recommended, use Compute[:linode] for portability")
Fog::Compute.new(:provider => 'Linode')
when :dns
Fog::Logger.warning("Linode[:storage] is deprecated, use Storage[:linode] instead")
Fog::Logger.warning("Linode[:dns] is not recommended, use DNS[:linode] for portability")
Fog::DNS.new(:provider => 'Linode')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Local < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :storage
Fog::Logger.warning("Local[:storage] is deprecated, use Storage[:local] instead")
Fog::Logger.warning("Local[:storage] is not recommended, use Storage[:local] for portability")
Fog::Storage.new(:provider => 'Local')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class NewServers < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("NewServers[:compute] is deprecated, use Compute[:newservers] instead")
Fog::Logger.warning("NewServers[:compute] is not recommended, use Compute[:newservers] for portability")
Fog::Compute.new(:provider => 'NewServers')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -16,10 +16,10 @@ class Ninefold < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Ninefold[:compute] is deprecated, use Compute[:ninefold] instead")
Fog::Logger.warning("Ninefold[:compute] is not recommended, use Compute[:ninefold] for portability")
Fog::Compute.new(:provider => 'Ninefold')
when :storage
Fog::Logger.warning("Ninefold[:storage] is deprecated, use Storage[:ninefold] instead")
Fog::Logger.warning("Ninefold[:storage] is not recommended, use Storage[:ninefold] for portability")
Fog::Storage.new(:provider => 'Ninefold')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

@ -14,7 +14,7 @@ class OpenStack < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("OpenStack[:compute] is deprecated, use Compute[:rackspace] instead")
Fog::Logger.warning("OpenStack[:compute] is not recommended, use Compute[:rackspace] for portability")
Fog::Compute.new(:provider => 'OpenStack')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -22,17 +22,17 @@ class Rackspace < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :cdn
Fog::Logger.warning("Rackspace[:cdn] is deprecated, use CDN[:rackspace] instead")
Fog::Logger.warning("Rackspace[:cdn] is not recommended, use CDN[:rackspace] for portability")
Fog::CDN.new(:provider => 'Rackspace')
when :compute
Fog::Logger.warning("Rackspace[:compute] is deprecated, use Compute[:rackspace] instead")
Fog::Logger.warning("Rackspace[:compute] is not recommended, use Compute[:rackspace] for portability")
Fog::Compute.new(:provider => 'Rackspace')
when :dns
Fog::DNS.new(:provider => 'Rackspace')
when :load_balancers
Fog::Rackspace::LoadBalancers.new
when :storage
Fog::Logger.warning("Rackspace[:storage] is deprecated, use Storage[:rackspace] instead")
Fog::Logger.warning("Rackspace[:storage] is not recommended, use Storage[:rackspace] for portability")
Fog::Storage.new(:provider => 'Rackspace')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -16,7 +16,7 @@ class Slicehost < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Slicehost[:compute] is deprecated, use Compute[:slicehost] instead")
Fog::Logger.warning("Slicehost[:compute] is not recommended, use Compute[:slicehost] for portability")
Fog::Compute.new(:provider => 'Slicehost')
when :dns
Fog::Logger.warning("Slicehost[:dns] is deprecated, use Storage[:slicehost] instead")

View file

@ -14,7 +14,7 @@ class StormOnDemand < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("StormOnDemand[:compute] is deprecated, use Compute[:stormondemand] instead")
Fog::Logger.warning("StormOnDemand[:compute] is not recommended, use Compute[:stormondemand] for portability")
Fog::Compute.new(:provider => 'StormOnDemand')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ module VirtualBox # deviates from other bin stuff to accomodate gem
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("VirtualBox[:compute] is deprecated, use Compute[:virtualbox] instead")
Fog::Logger.warning("VirtualBox[:compute] is not recommended, use Compute[:virtualbox] for portability")
Fog::Compute.new(:provider => 'VirtualBox')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ module Vmfusion # deviates from other bin stuff to accomodate gem
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Vmfusion[:compute] is deprecated, use Compute[:Vmfusion] instead")
Fog::Logger.warning("Vmfusion[:compute] is not recommended, use Compute[:vmfusion] for portability")
Fog::Compute.new(:provider => 'Vmfusion')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Voxel < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("Voxel[:compute] is deprecated, use Compute[:voxel] instead")
Fog::Logger.warning("Voxel[:comupte] is not recommended, use Compute[:voxel]] for portability")
Fog::Compute.new(:provider => 'Voxel')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class Zerigo < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::Logger.warning("Zerigo[:dns] is deprecated, use Storage[:zerigo] instead")
Fog::Logger.warning("Zerigo[:dns] is not recommended, use DNS[:zerigo] for portability")
Fog::DNS.new(:provider => 'Zerigo')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -53,7 +53,7 @@ module Fog
def reset_ftp_password
requires :identity
connection.reset_ftp_password_account(identity)["library_ftp_password"]
connection.reset_ftp_password_account["library_ftp_password"]
end
end

View file

@ -142,7 +142,7 @@ module Fog
unless self.class.ignored_attributes.include?(key)
if aliased_key = self.class.aliases[key]
send("#{aliased_key}=", value)
elsif (public_methods | private_methods).detect {|method| ["#{key}=", :"#{key}="].include?(method)}
elsif self.respond_to?("#{key}=",true)
send("#{key}=", value)
else
attributes[key] = value

View file

@ -4,7 +4,7 @@ module Fog
def deprecate(older, newer)
module_eval <<-EOS, __FILE__, __LINE__
def #{older}(*args)
Fog::Logger.warning("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
send(:#{newer}, *args)
end
EOS
@ -13,7 +13,7 @@ module Fog
def self_deprecate(older, newer)
module_eval <<-EOS, __FILE__, __LINE__
def self.#{older}(*args)
Fog::Logger.warning("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("#{self} => ##{older} is deprecated, use ##{newer} instead [light_black](#{caller.first})[/]")
send(:#{newer}, *args)
end
EOS

View file

@ -2,7 +2,8 @@ module Fog
class Logger
@channels = {
:warning => ::STDOUT
:deprecation => ::STDOUT,
:warning => ::STDOUT
}
def self.[](channel)
@ -17,6 +18,10 @@ module Fog
self.write(:debug, "[light_black][DEBUG] #{message}[/]")
end
def self.deprecation(message)
self.write(:deprecation, "[yellow][DEPRECATION] #{message}[/]")
end
def self.warning(message)
self.write(:warning, "[yellow][WARNING] #{message}[/]")
end

View file

@ -1,13 +1,18 @@
module Fog
def self.providers
@providers ||= []
@providers ||= {}
end
def self.providers=(new_providers)
@providers = new_providers
end
module Provider
def self.extended(base)
Fog.providers << base.to_s.split('::').last
provider = base.to_s.split('::').last
Fog.providers[provider.downcase.to_sym] = provider
end
def [](service_key)

View file

@ -172,7 +172,7 @@ module Fog
end
def recognized
@recognized ||= []
@recognized ||= [:connection_options]
end
def validate_options(options)

View file

@ -1061,7 +1061,7 @@ module Fog
end
def self.data_reset
Fog::Logger.warning("#{self} => #data_reset is deprecated, use #reset instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("#{self} => #data_reset is deprecated, use #reset instead [light_black](#{caller.first})[/]")
self.reset
end

View file

@ -106,7 +106,7 @@ module Fog
def save(options = {})
requires :body, :directory, :key
if options != {}
Fog::Logger.warning("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
end
options['x-goog-acl'] ||= @acl if @acl
options['Cache-Control'] = cache_control if cache_control

View file

@ -18,7 +18,7 @@ module Fog
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
get_object_https_url(bucket_name, object_name, expires)
end
@ -27,7 +27,7 @@ module Fog
class Mock # :nodoc:all
def get_object_url(bucket_name, object_name, expires)
Fog::Logger.warning("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
get_object_https_url(bucket_name, object_name, expires)
end

View file

@ -45,7 +45,7 @@ module Fog
end
def url(params, expires)
Fog::Logger.warning("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
https_url(params, expires)
end

View file

@ -88,12 +88,13 @@ module Fog
response = connection.request({
:expects => [200, 204],
:body => req_body,
:headers => {'Content-Type' => 'application/json'},
:body => MultiJson.encode(req_body),
:host => uri.host,
:method => 'GET',
:method => 'POST',
:path => (uri.path and not uri.path.empty?) ? uri.path : 'v2.0'
})
body=response.body
body=MultiJson.decode(response.body)
if body['auth']['serviceCatalog'] and body['auth']['serviceCatalog'][@compute_service_name] and body['auth']['serviceCatalog'][@compute_service_name][0] then
mgmt_url = body['auth']['serviceCatalog'][@compute_service_name][0]['publicURL']

View file

@ -6,8 +6,8 @@ module Fog
module Compute
class OpenStack < Fog::Service
requires :openstack_api_key, :openstack_username, :openstack_auth_url, :openstack_tenant
recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_compute_service_name
requires :openstack_api_key, :openstack_username, :openstack_auth_url
recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_compute_service_name, :openstack_tenant
model_path 'fog/openstack/models/compute'
model :flavor
@ -167,7 +167,7 @@ module Fog
:openstack_tenant => @openstack_tenant,
:openstack_compute_service_name => @openstack_compute_service_name
}
if @openstack_auth_url =~ /.*v2.0\/?$/
if @openstack_auth_url =~ /\/v2.0\//
credentials = Fog::OpenStack.authenticate_v2(options, @connection_options)
else
credentials = Fog::OpenStack.authenticate_v1(options, @connection_options)
@ -181,8 +181,11 @@ module Fog
end
@host = uri.host
@path = uri.path
# Force URL into v1.1 namespace (what this binding supports)
@path.sub!(/\/.*\/?/, '/v1.1/')
@path.sub!(/\/$/, '')
unless @path.match(/1\.1/)
raise Fog::Compute::OpenStack::ServiceUnavailable.new(
"OpenStack binding only supports version 1.1")
end
# Add tenant
@path += @openstack_tenant if @openstack_tenant
@port = uri.port

View file

@ -20,6 +20,8 @@ module Fog
attribute :progress
attribute :accessIPv4
attribute :accessIPv6
attribute :availability_zone
attribute :user_data_encoded
attribute :state, :aliases => 'status'
attr_reader :password
@ -27,6 +29,7 @@ module Fog
def initialize(attributes={})
@connection = attributes[:connection]
attributes[:metadata] = {}
super
end
@ -45,6 +48,10 @@ module Fog
metadata.load(metas)
end
def user_data=(ascii_userdata)
self.user_data_encoded = [ascii_userdata].pack('m')
end
def destroy
requires :id
connection.delete_server(id)
@ -152,7 +159,9 @@ module Fog
'metadata' => meta_hash,
'personality' => personality,
'accessIPv4' => accessIPv4,
'accessIPv6' => accessIPv6
'accessIPv6' => accessIPv6,
'availability_zone' => availability_zone,
'user_data' => user_data_encoded
}
options = options.reject {|key, value| value.nil?}
data = connection.create_server(name, image_ref, flavor_ref, options)

View file

@ -12,15 +12,12 @@ module Fog
}
}
if options['metadata']
data['server']['metadata'] = options['metadata']
end
if options['accessIPv4']
data['server']['accessIPv4'] = options['accessIPv4']
end
if options['accessIPv6']
data['server']['accessIPv6'] = options['accessIPv6']
vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6',
'availability_zone', 'user_data']
vanilla_options.select{|o| options[o]}.each do |key|
data['server'][key] = options[key]
end
if options['personality']
data['server']['personality'] = []
for file in options['personality']
@ -30,6 +27,7 @@ module Fog
}
end
end
request(
:body => MultiJson.encode(data),
:expects => [200, 202],

View file

@ -15,7 +15,7 @@ module Fog
extend Fog::Terremark::Shared
def self.new(options={})
Fog::Logger.warning("Fog::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe [light_black](#{caller.first})[/]")
Fog::Logger.deprecation("Fog::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe [light_black](#{caller.first})[/]")
unless @required
shared_requires

View file

@ -18,6 +18,11 @@ Shindo.tests('AWS::CloudFormation | stack requests', ['aws', 'cloudformation'])
'StackId' => String
}
@update_stack_format = {
'RequestId' => String,
'StackId' => String
}
@get_template_format = {
'RequestId' => String,
'TemplateBody' => String
@ -103,6 +108,15 @@ Shindo.tests('AWS::CloudFormation | stack requests', ['aws', 'cloudformation'])
).body
end
tests("update_stack('#{@stack_name}', 'TemplateURL' => '#{@template_url}', Parameters => {'KeyName' => 'cloudformation'})").formats(@update_stack_format) do
pending if Fog.mocking?
Fog::AWS[:cloud_formation].update_stack(
@stack_name,
'TemplateURL' => @template_url,
'Parameters' => {'KeyName' => 'cloudformation'}
).body
end
tests("get_template('#{@stack_name})").formats(@get_template_format) do
pending if Fog.mocking?
Fog::AWS[:cloud_formation].get_template(@stack_name).body

View file

@ -138,6 +138,21 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do
data
end
if Fog.mocking?
# Ensure the new instance doesn't show up in mock describe_instances right away
tests("#describe_instances").formats(@describe_instances_format) do
body = Fog::Compute[:aws].describe_instances.body
instance_ids = body['reservationSet'].map {|reservation| reservation['instancesSet'].map {|instance| instance['instanceId'] } }.flatten
test("doesn't include the new instance") { !instance_ids.include?(@instance_id) }
body
end
# But querying for the new instance directly should raise an error
tests("#describe_instances('instance-id' => '#{@instance_id}')").raises(Fog::Compute::AWS::NotFound) do
Fog::Compute[:aws].describe_instances('instance-id' => @instance_id)
end
end
server = Fog::Compute[:aws].servers.get(@instance_id)
while server.nil? do
# It may take a moment to get the server after launching it