mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fixing more warnings
This commit is contained in:
parent
9ff06a8768
commit
c53b5e273c
19 changed files with 97 additions and 99 deletions
2
bin/fog
2
bin/fog
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog'))
|
||||
require 'irb'
|
||||
require 'yaml'
|
||||
require File.join('fog', 'core', 'credentials')
|
||||
|
|
|
@ -74,8 +74,8 @@ module Fog
|
|||
def self.data
|
||||
@data ||= Hash.new do |hash, region|
|
||||
owner_id = Fog::AWS::Mock.owner_id
|
||||
hash[region] = Hash.new do |hash, key|
|
||||
hash[key] = {
|
||||
hash[region] = Hash.new do |region_hash, key|
|
||||
region_hash[key] = {
|
||||
:deleted_at => {},
|
||||
:addresses => {},
|
||||
:instances => {},
|
||||
|
|
|
@ -48,13 +48,13 @@ module Fog
|
|||
|
||||
# make sure port 22 is open in the first security group
|
||||
security_group = connection.security_groups.get(server.groups.first)
|
||||
ip_permission = security_group.ip_permissions.detect do |ip_permission|
|
||||
authorized = security_group.ip_permissions.detect do |ip_permission|
|
||||
ip_permission['ipRanges'].first && ip_permission['ipRanges'].first['cidrIp'] == '0.0.0.0/0' &&
|
||||
ip_permission['fromPort'] == 22 &&
|
||||
ip_permission['ipProtocol'] == 'tcp' &&
|
||||
ip_permission['toPort'] == 22
|
||||
end
|
||||
unless ip_permission
|
||||
unless authorized
|
||||
security_group.authorize_port_range(22..22)
|
||||
end
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
|||
@image[name] = @value
|
||||
when 'blockDeviceMapping'
|
||||
@in_block_device_mapping = false
|
||||
when 'deviceName', 'virtualName', 'snapshotId', 'volumeSize', 'deleteOnTermination'
|
||||
when 'deviceName', 'virtualName', 'snapshotId', 'deleteOnTermination'
|
||||
@block_device_mapping[name] = @value
|
||||
when 'isPublic'
|
||||
if @value == 'true'
|
||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
|||
@response['MaxKeys'] = @value.to_i
|
||||
when 'Size'
|
||||
@object['Size'] = @value.to_i
|
||||
when 'Delimeter', 'Key', 'Name', 'StorageClass'
|
||||
when 'Delimeter', 'Key', 'StorageClass'
|
||||
@object[name] = @value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,17 +65,17 @@ module Fog
|
|||
elsif @in_version
|
||||
@version
|
||||
end['LastModified'] = Time.parse(@value)
|
||||
when 'KeyMarker', 'Name', 'Prefix', 'VersionIdMarker'
|
||||
@response[name] = @value
|
||||
when 'MaxKeys'
|
||||
@response['MaxKeys'] = @value.to_i
|
||||
when 'Size'
|
||||
@version['Size'] = @value.to_i
|
||||
when 'Key', 'Name', 'StorageClass', 'VersionId'
|
||||
when 'Key', 'KeyMarker', 'Name', 'Prefix', 'StorageClass', 'VersionId', 'VersionIdMarker'
|
||||
if @in_delete_marker
|
||||
@delete_marker
|
||||
elsif @in_version
|
||||
@version
|
||||
else
|
||||
@response
|
||||
end[name] = @value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,8 +53,8 @@ module Fog
|
|||
response.status = 200
|
||||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'keySet' => key_set.map do |key|
|
||||
key.reject {|key,value| !['keyFingerprint', 'keyName'].include?(key)}
|
||||
'keySet' => key_set.map do |key_pair|
|
||||
key_pair.reject {|key,value| !['keyFingerprint', 'keyName'].include?(key)}
|
||||
end
|
||||
}
|
||||
response
|
||||
|
|
|
@ -75,8 +75,8 @@ module Fog
|
|||
|
||||
def self.data
|
||||
@data ||= Hash.new do |hash, region|
|
||||
hash[region] = Hash.new do |hash, key|
|
||||
hash[key] = {
|
||||
hash[region] = Hash.new do |region_hash, key|
|
||||
region_hash[key] = {
|
||||
:buckets => {}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
|||
@response['MaxKeys'] = @value.to_i
|
||||
when 'Size'
|
||||
@object['Size'] = @value.to_i
|
||||
when 'Delimeter', 'Key', 'Name', 'StorageClass'
|
||||
when 'Delimeter', 'Key', 'StorageClass'
|
||||
@object[name] = @value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,10 +45,7 @@ module Fog
|
|||
file.close
|
||||
new(data)
|
||||
else
|
||||
body = nil
|
||||
::File.open(path) do |file|
|
||||
body = file.read
|
||||
end
|
||||
body = ::File.read(path)
|
||||
new(data.merge!(:body => body))
|
||||
end
|
||||
else
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
|
||||
def delete_image(image_id)
|
||||
response = Excon::Response.new
|
||||
if image = list_images_detail.body['images'].detect {|image| image['id'] == image_id}
|
||||
if image = list_images_detail.body['images'].detect {|_| _['id'] == image_id}
|
||||
if image['status'] == 'SAVING'
|
||||
response.status = 409
|
||||
raise(Excon::Errors.status_error({:expects => 202}, response))
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
|
||||
def delete_server(server_id)
|
||||
response = Excon::Response.new
|
||||
if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id }
|
||||
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
||||
if server['status'] == 'BUILD'
|
||||
response.status = 409
|
||||
raise(Excon::Errors.status_error({:expects => 202}, response))
|
||||
|
|
|
@ -37,7 +37,7 @@ module Fog
|
|||
|
||||
def get_server_details(server_id)
|
||||
response = Excon::Response.new
|
||||
if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id }
|
||||
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
||||
response.status = [200, 203][rand(1)]
|
||||
response.body = { 'server' => server }
|
||||
response
|
||||
|
|
|
@ -28,7 +28,7 @@ module Fog
|
|||
|
||||
def list_addresses(server_id)
|
||||
response = Excon::Response.new
|
||||
if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id }
|
||||
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
||||
response.status = [200, 203][rand(1)]
|
||||
response.body = { 'addresses' => server['addresses'] }
|
||||
response
|
||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
|||
|
||||
def list_private_addresses(server_id)
|
||||
response = Excon::Response.new
|
||||
if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id }
|
||||
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
||||
response.status = [200, 203][rand(1)]
|
||||
response.body = { 'private' => server['addresses']['private'] }
|
||||
response
|
||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
|||
|
||||
def list_public_addresses(server_id)
|
||||
response = Excon::Response.new
|
||||
if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id }
|
||||
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
||||
response.status = [200, 203][rand(1)]
|
||||
response.body = { 'public' => server['addresses']['public'] }
|
||||
response
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
|
||||
def update_server(server_id, options)
|
||||
response = Excon::Response.new
|
||||
if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id }
|
||||
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
||||
if options['adminPass']
|
||||
server['adminPass'] = options['adminPass']
|
||||
end
|
||||
|
|
|
@ -28,6 +28,7 @@ module Fog
|
|||
else
|
||||
Fog::Terremark::Ecloud::Real.new(options)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Real
|
||||
|
|
Loading…
Add table
Reference in a new issue