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

[core] use logger throughout for warnings

This commit is contained in:
geemus 2011-09-02 12:30:10 -05:00
parent e52ae34962
commit 76c0f11670
52 changed files with 84 additions and 100 deletions

View file

@ -93,7 +93,7 @@ module Fog
class Real
def modify_image_attributes(*params)
Formatador.display_line("[yellow][WARN] modify_image_attributes is deprecated, use modify_image_attribute instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('public-ip' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('key-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('group-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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

@ -57,7 +57,7 @@ module Fog
def all(filters = self.filters)
unless filters.is_a?(Hash)
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('instance-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('volume-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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 != {}
Formatador.display_line("[yellow][WARN] options param is deprecated, use acl= instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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

@ -28,10 +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)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
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})[/]")
options = group_name
group_name = options['GroupName']
end
@ -49,10 +46,7 @@ module Fog
def authorize_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
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})[/]")
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)
Formatador.display_line("[yellow][WARN] describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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,12 +60,12 @@ module Fog
def describe_images(filters = {})
unless filters.is_a?(Hash)
Formatador.display_line("[yellow][WARN] describe_images with #{filters.class} param is deprecated, use describe_images('image-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("describe_images with #{filters.class} param is deprecated, use describe_images('image-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'image-id' => [*filters]}
end
if filters.keys.any? {|key| key =~ /^block-device/}
Formatador.display_line("[yellow][WARN] describe_images block-device-mapping filters are not yet mocked[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("describe_images block-device-mapping filters are not yet mocked [light_black](#{caller.first})[/]")
Fog::Mock.not_implemented
end

View file

@ -54,7 +54,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)
Formatador.display_line("[yellow][WARN] describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end
params = {}
@ -77,7 +77,7 @@ module Fog
def describe_instances(filters = {})
unless filters.is_a?(Hash)
Formatador.display_line("[yellow][WARN] describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
end

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)
Formatador.display_line("[yellow][WARN] describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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?
Formatador.display_line("[yellow][WARN] describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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?
Formatador.display_line("[yellow][WARN] describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
end
response = Excon::Response.new
@ -66,10 +66,10 @@ module Fog
snapshot_set = self.data[:snapshots].values
if filters.delete('owner-alias')
Formatador.display_line("[yellow][WARN] describe_snapshots with owner-alias is not mocked[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("describe_snapshots with owner-alias is not mocked [light_black](#{caller.first})[/]")
end
if (restorable_by = filters.delete('RestorableBy')) && restorable_by != 'self'
Formatador.display_line("[yellow][WARN] describe_snapshots with RestorableBy other than 'self' (wanted #{restorable_by.inspect}) is not mocked[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("describe_snapshots with RestorableBy other than 'self' (wanted #{restorable_by.inspect}) is not mocked [light_black](#{caller.first})[/]")
end
snapshot_set = apply_tag_filters(snapshot_set, filters)

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)
Formatador.display_line("[yellow][WARN] describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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

@ -32,9 +32,9 @@ module Fog
:parser => Fog::Parsers::Compute::AWS::Basic.new
}.merge!(params))
end
def modify_instance_attributes(instance_id, attributes)
Formatador.display_line("[yellow][WARN] modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead[/]")
Fog::Logger.warning("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
modify_instance_attribute(instance_id, attributes)
end

View file

@ -27,10 +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)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
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})[/]")
options = group_name
group_name = options['GroupName']
end
@ -48,10 +45,7 @@ module Fog
def revoke_security_group_ingress(group_name, options = {})
if group_name.is_a?(Hash)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
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})[/]")
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)
Formatador.display_line("[yellow][WARN] get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] get_attributes with string next_token param is deprecated, use 'AttributeName' => attributes) instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] Fog::Storage::AWS => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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

@ -76,7 +76,7 @@ module Fog
end
def url(params, expires)
Formatador.display_line("[yellow][WARN] #{Fog::Storage::AWS} => #url is deprecated, use #https_url instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("Fog::Storage::AWS => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
https_url(params, expires)
end
@ -305,7 +305,7 @@ DATA
subdomain = params[:host].split(".#{@host}").first
unless subdomain =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
Formatador.display_line("[yellow][WARN] fog: the specified s3 bucket name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html[/]")
Fog::Logger.warning("fog: the specified s3 bucket name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html")
params[:host] = params[:host].split("#{subdomain}.")[-1]
if params[:path]
params[:path] = "#{subdomain}/#{params[:path]}"
@ -367,7 +367,7 @@ DATA
response = @connection.request(params, &block)
rescue Excon::Errors::TemporaryRedirect => error
uri = URI.parse(error.response.headers['Location'])
Formatador.display_line("[yellow][WARN] fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant[/]")
Fog::Logger.warning("fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant")
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false).request(original_params, &block)
end

View file

@ -19,8 +19,7 @@ module Fog
service = self.class_for(service)
availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) }
rescue ArgumentError => e
warning = "[yellow][WARN] #{e.message}[/]"
Formatador.display_line(warning)
Fog::Logger.warning(e.message)
availability = false
rescue => e
availability = false

View file

@ -45,17 +45,17 @@ class AWS < Fog::Bin
when :auto_scaling
Fog::AWS::AutoScaling.new
when :cdn
Formatador.display_line("[yellow][WARN] AWS[:cdn] is deprecated, use CDN[:aws] instead[/]")
Fog::Logger.warning("AWS[:cdn] is deprecated, use CDN[:aws] instead")
Fog::CDN.new(:provider => 'AWS')
when :cloud_formation
Fog::AWS::CloudFormation.new
when :cloud_watch
Fog::AWS::CloudWatch.new
when :compute
Formatador.display_line("[yellow][WARN] AWS[:compute] is deprecated, use Compute[:aws] instead[/]")
Fog::Logger.warning("AWS[:compute] is deprecated, use Compute[:aws] instead")
Fog::Compute.new(:provider => 'AWS')
when :dns
Formatador.display_line("[yellow][WARN] AWS[:dns] is deprecated, use DNS[:aws] instead[/]")
Fog::Logger.warning("AWS[:dns] is deprecated, use DNS[:aws] instead")
Fog::DNS.new(:provider => 'AWS')
when :elb
Fog::AWS::ELB.new
@ -72,7 +72,7 @@ class AWS < Fog::Bin
when :sqs
Fog::AWS::SQS.new
when :storage
Formatador.display_line("[yellow][WARN] AWS[:storage] is deprecated, use Storage[:aws] instead[/]")
Fog::Logger.warning("AWS[:storage] is deprecated, use Storage[:aws] instead")
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
Formatador.display_line("[yellow][WARN] Bluebox[:compute] is deprecated, use Compute[:bluebox] instead[/]")
Fog::Logger.warning("Bluebox[:compute] is deprecated, use Compute[:bluebox] instead")
Fog::Compute.new(:provider => 'Bluebox')
when :dns
Formatador.display_line("[yellow][WARN] Bluebox[:storage] is deprecated, use Storage[:bluebox] instead[/]")
Fog::Logger.warning("Bluebox[:storage] is deprecated, use Storage[:bluebox] instead")
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
Formatador.display_line("[yellow][WARN] Brightbox[:compute] is deprecated, use Compute[:brightbox] instead[/]")
Fog::Logger.warning("Brightbox[:compute] is deprecated, use Compute[:brightbox] instead")
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
Formatador.display_line("[yellow][WARN] DNSimple[:dns] is deprecated, use Storage[:dnsimple] instead[/]")
Fog::Logger.warning("DNSimple[:dns] is deprecated, use Storage[:dnsimple] instead")
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
Formatador.display_line("[yellow][WARN] DNSMadeEasy[:dns] is deprecated, use Storage[:dnsmadeeasy] instead[/]")
Fog::Logger.warning("DNSMadeEasy[:dns] is deprecated, use Storage[:dnsmadeeasy] instead")
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
Formatador.display_line("[yellow][WARN] Ecloud[:compute] is deprecated, use Compute[:ecloud] instead[/]")
Fog::Logger.warning("Ecloud[:compute] is deprecated, use Compute[:ecloud] instead")
Fog::Compute.new(:provider => 'Ecloud')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class GoGrid < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] GoGrid[:compute] is deprecated, use Compute[:gogrid] instead[/]")
Fog::Logger.warning("GoGrid[:compute] is deprecated, use Compute[:gogrid] instead")
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
Formatador.display_line("[yellow][WARN] Google[:storage] is deprecated, use Storage[:google] instead[/]")
Fog::Logger.warning("Google[:storage] is deprecated, use Storage[:google] instead")
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
Formatador.display_line("[yellow][WARN] Libvirt[:compute] is deprecated, use Compute[:libvirt] instead[/]")
Fog::Logger.warning("Libvirt[:compute] is deprecated, use Compute[:libvirt] instead")
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
Formatador.display_line("[yellow][WARN] Linode[:compute] is deprecated, use Compute[:linode] instead[/]")
Fog::Logger.warning("Linode[:compute] is deprecated, use Compute[:linode] instead")
Fog::Compute.new(:provider => 'Linode')
when :dns
Formatador.display_line("[yellow][WARN] Linode[:storage] is deprecated, use Storage[:linode] instead[/]")
Fog::Logger.warning("Linode[:storage] is deprecated, use Storage[:linode] instead")
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
Formatador.display_line("[yellow][WARN] Local[:storage] is deprecated, use Storage[:local] instead[/]")
Fog::Logger.warning("Local[:storage] is deprecated, use Storage[:local] instead")
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
Formatador.display_line("[yellow][WARN] NewServers[:compute] is deprecated, use Compute[:newservers] instead[/]")
Fog::Logger.warning("NewServers[:compute] is deprecated, use Compute[:newservers] instead")
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
Formatador.display_line("[yellow][WARN] Ninefold[:compute] is deprecated, use Compute[:ninefold] instead[/]")
Fog::Logger.warning("Ninefold[:compute] is deprecated, use Compute[:ninefold] instead")
Fog::Compute.new(:provider => 'Ninefold')
when :storage
Formatador.display_line("[yellow][WARN] Ninefold[:storage] is deprecated, use Storage[:ninefold] instead[/]")
Fog::Logger.warning("Ninefold[:storage] is deprecated, use Storage[:ninefold] instead")
Fog::Storage.new(:provider => 'Ninefold')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

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

View file

@ -16,10 +16,10 @@ class Slicehost < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Slicehost[:compute] is deprecated, use Compute[:slicehost] instead[/]")
Fog::Logger.warning("Slicehost[:compute] is deprecated, use Compute[:slicehost] instead")
Fog::Compute.new(:provider => 'Slicehost')
when :dns
Formatador.display_line("[yellow][WARN] Slicehost[:dns] is deprecated, use Storage[:slicehost] instead[/]")
Fog::Logger.warning("Slicehost[:dns] is deprecated, use Storage[:slicehost] instead")
Fog::DNS.new(:provider => 'Slicehost')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -14,7 +14,7 @@ class StormOnDemand < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] StormOnDemand[:compute] is deprecated, use Compute[:stormondemand] instead[/]")
Fog::Logger.warning("StormOnDemand[:compute] is deprecated, use Compute[:stormondemand] instead")
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
Formatador.display_line("[yellow][WARN] VirtualBox[:compute] is deprecated, use Compute[:virtualbox] instead[/]")
Fog::Logger.warning("VirtualBox[:compute] is deprecated, use Compute[:virtualbox] instead")
Fog::Compute.new(:provider => 'VirtualBox')
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
Formatador.display_line("[yellow][WARN] Voxel[:compute] is deprecated, use Compute[:voxel] instead[/]")
Fog::Logger.warning("Voxel[:compute] is deprecated, use Compute[:voxel] instead")
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
Formatador.display_line("[yellow][WARN] Zerigo[:dns] is deprecated, use Storage[:zerigo] instead[/]")
Fog::Logger.warning("Zerigo[:dns] is deprecated, use Storage[:zerigo] instead")
Fog::DNS.new(:provider => 'Zerigo')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

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

View file

@ -1065,7 +1065,7 @@ module Fog
end
def self.data_reset
Formatador.display_line("[yellow][WARN] #{self} => #data_reset is deprecated, use #reset instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("#{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 != {}
Formatador.display_line("[yellow][WARN] options param is deprecated, use acl= instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("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)
Formatador.display_line("[yellow][WARN] Fog::Storage::Google => #url is deprecated, use #https_url instead[/] [light_black](#{caller.first})[/]")
Fog::Logger.warning("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
https_url(params, expires)
end
@ -227,7 +227,7 @@ DATA
subdomain = params[:host].split(".#{@host}").first
unless subdomain =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
Formatador.display_line("[yellow][WARN] fog: the specified google storage bucket name(#{subdomain}) is not a valid dns name. See: http://code.google.com/apis/storage/docs/developer-guide.html#naming[/]")
Fog::Logger.warning("fog: the specified google storage bucket name(#{subdomain}) is not a valid dns name. See: http://code.google.com/apis/storage/docs/developer-guide.html#naming")
params[:host] = params[:host].split("#{subdomain}.")[-1]
if params[:path]
params[:path] = "#{subdomain}/#{params[:path]}"

View file

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