diff --git a/lib/fog/aws/compute.rb b/lib/fog/aws/compute.rb index fc7e40765..23b8f509a 100644 --- a/lib/fog/aws/compute.rb +++ b/lib/fog/aws/compute.rb @@ -334,13 +334,13 @@ module Fog tag_set_fetcher = lambda {|resource| self.data[:tag_sets][resource[resource_id_key]] } # tag-key: match resources tagged with this key (any value) - if filters.has_key?('tag-key') + if filters.key?('tag-key') value = filters.delete('tag-key') - resources = resources.select{|r| tag_set_fetcher[r].has_key?(value)} + resources = resources.select{|r| tag_set_fetcher[r].key?(value)} end # tag-value: match resources tagged with this value (any key) - if filters.has_key?('tag-value') + if filters.key?('tag-value') value = filters.delete('tag-value') resources = resources.select{|r| tag_set_fetcher[r].values.include?(value)} end diff --git a/lib/fog/aws/models/beanstalk/templates.rb b/lib/fog/aws/models/beanstalk/templates.rb index f862b14c6..b94e176b6 100644 --- a/lib/fog/aws/models/beanstalk/templates.rb +++ b/lib/fog/aws/models/beanstalk/templates.rb @@ -13,7 +13,7 @@ module Fog # a describe configuration templates call in the AWS API. def all(options={}) application_filter = [] - if options.has_key?('ApplicationName') + if options.key?('ApplicationName') application_filter << options['ApplicationName'] end diff --git a/lib/fog/aws/models/compute/key_pair.rb b/lib/fog/aws/models/compute/key_pair.rb index f5f397296..1ba3d6e13 100644 --- a/lib/fog/aws/models/compute/key_pair.rb +++ b/lib/fog/aws/models/compute/key_pair.rb @@ -45,7 +45,7 @@ module Fog end def writable? - !!(private_key && ENV.has_key?('HOME')) + !!(private_key && ENV.key?('HOME')) end end end diff --git a/lib/fog/aws/models/dns/records.rb b/lib/fog/aws/models/dns/records.rb index d7fd6d2ba..13a08182b 100644 --- a/lib/fog/aws/models/dns/records.rb +++ b/lib/fog/aws/models/dns/records.rb @@ -28,7 +28,7 @@ module Fog data = service.list_resource_record_sets(zone.id, options).body # NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks. - data['NextRecordIdentifier'] = nil unless data.has_key?('NextRecordIdentifier') + data['NextRecordIdentifier'] = nil unless data.key?('NextRecordIdentifier') merge_attributes(data.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextRecordName', 'NextRecordType', 'NextRecordIdentifier'].include?(key)}) load(data['ResourceRecordSets']) @@ -55,7 +55,7 @@ module Fog batch = service.list_resource_record_sets(zone.id, options).body # NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks. - batch['NextRecordIdentifier'] = nil unless batch.has_key?('NextRecordIdentifier') + batch['NextRecordIdentifier'] = nil unless batch.key?('NextRecordIdentifier') merge_attributes(batch.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextRecordName', 'NextRecordType', 'NextRecordIdentifier'].include?(key)}) diff --git a/lib/fog/aws/models/iam/roles.rb b/lib/fog/aws/models/iam/roles.rb index f8a580af7..db7c6e169 100644 --- a/lib/fog/aws/models/iam/roles.rb +++ b/lib/fog/aws/models/iam/roles.rb @@ -26,7 +26,7 @@ module Fog end def new(attributes = {}) - if not attributes.has_key?(:assume_role_policy_document) + if not attributes.key?(:assume_role_policy_document) attributes[:assume_role_policy_document] = Fog::AWS::IAM::EC2_ASSUME_ROLE_POLICY.to_s end super diff --git a/lib/fog/aws/parsers/beanstalk/parser.rb b/lib/fog/aws/parsers/beanstalk/parser.rb index c39988ca9..aac9e261c 100644 --- a/lib/fog/aws/parsers/beanstalk/parser.rb +++ b/lib/fog/aws/parsers/beanstalk/parser.rb @@ -34,7 +34,7 @@ module Fog if @parse_stack.last[:type] == :object @parse_stack.last[:value] << {} # Push any empty object end - elsif @list_tags.has_key?(name) + elsif @list_tags.key?(name) set_value(name, [], :array) # Set an empty array @parse_stack.push({ :type => @tags[name], :value => get_parent[name] }) elsif @tags[name] == :object @@ -52,9 +52,9 @@ module Fog when 'RequestId' @response['ResponseMetadata'][name] = value else - if @list_tags.has_key?(name) || @tags[name] == :object + if @list_tags.key?(name) || @tags[name] == :object @parse_stack.pop() - elsif @tags.has_key?(name) + elsif @tags.key?(name) set_value(name, value, @tags[name]) end end diff --git a/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb b/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb index 36c703156..ecf70960c 100644 --- a/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +++ b/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb @@ -53,7 +53,7 @@ module Fog @response['ResponseMetadata'][name] = value when 'member' if !@in_dimensions - if @metric_alarms.has_key?('AlarmName') + if @metric_alarms.key?('AlarmName') @response['DescribeAlarmsResult']['MetricAlarms'] << @metric_alarms reset_metric_alarms elsif @response['DescribeAlarmsResult']['MetricAlarms'].last != nil diff --git a/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb b/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb index 3450b4a8e..457d91057 100644 --- a/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +++ b/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb @@ -51,7 +51,7 @@ module Fog @response['ResponseMetadata'][name] = value when 'member' if !@in_dimensions - if @metric_alarms.has_key?('AlarmName') + if @metric_alarms.key?('AlarmName') @response['DescribeAlarmsForMetricResult']['MetricAlarms'] << @metric_alarms reset_metric_alarms elsif @response['DescribeAlarmsForMetricResult']['MetricAlarms'].last != nil diff --git a/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb b/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb index 9c2bf1f5f..3b110bb50 100644 --- a/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +++ b/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb @@ -99,10 +99,10 @@ module Fog raise Fog::AWS::AutoScaling::ValidationError.new("Options #{unexpected_options.join(',')} should not be included in request") end - if self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + if self.data[:auto_scaling_groups].key?(auto_scaling_group_name) raise Fog::AWS::AutoScaling::IdentifierTaken.new("AutoScalingGroup by this name already exists - A group with the name #{auto_scaling_group_name} already exists") end - unless self.data[:launch_configurations].has_key?(launch_configuration_name) + unless self.data[:launch_configurations].key?(launch_configuration_name) raise Fog::AWS::AutoScaling::ValidationError.new('Launch configuration name not found - null') end self.data[:auto_scaling_groups][auto_scaling_group_name] = { diff --git a/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb b/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb index f287c104b..fb8d36ec7 100644 --- a/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +++ b/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb @@ -75,7 +75,7 @@ module Fog class Mock def create_launch_configuration(image_id, instance_type, launch_configuration_name, options = {}) - if self.data[:launch_configurations].has_key?(launch_configuration_name) + if self.data[:launch_configurations].key?(launch_configuration_name) raise Fog::AWS::AutoScaling::IdentifierTaken.new("Launch Configuration by this name already exists - A launch configuration already exists with the name #{launch_configuration_name}") end self.data[:launch_configurations][launch_configuration_name] = { diff --git a/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb b/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb index eacf7b0b9..2c373432d 100644 --- a/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb +++ b/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb @@ -33,10 +33,10 @@ module Fog class Mock def delete_notification_configuration(auto_scaling_group_name, topic_arn) - unless self.data[:notification_configurations].has_key?(auto_scaling_group_name) + unless self.data[:notification_configurations].key?(auto_scaling_group_name) raise Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - %s' % auto_scaling_group_name) end - unless self.data[:notification_configurations][auto_scaling_group_name].has_key?(topic_arn) + unless self.data[:notification_configurations][auto_scaling_group_name].key?(topic_arn) raise Fog::AWS::AutoScaling::ValidationError.new("Notification Topic '#{topic_arn}' doesn't exist for '#{self.data[:owner_id]}'") end diff --git a/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb b/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb index 78b352fa4..cdee75628 100644 --- a/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb +++ b/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb @@ -38,7 +38,7 @@ module Fog class Mock def disable_metrics_collection(auto_scaling_group_name, options = {}) - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) Fog::AWS::AutoScaling::ValidationError.new("Group #{auto_scaling_group_name} not found") end diff --git a/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb b/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb index 84661969e..5fc414e1b 100644 --- a/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb +++ b/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb @@ -45,7 +45,7 @@ module Fog class Mock def enable_metrics_collection(auto_scaling_group_name, granularity, options = {}) - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) Fog::AWS::AutoScaling::ValidationError.new("Group #{auto_scaling_group_name} not found") end unless self.data[:metric_collection_types][:granularities].include?(granularity) diff --git a/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb b/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb index 2d746e43d..0ba8c0132 100644 --- a/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb +++ b/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb @@ -37,7 +37,7 @@ module Fog class Mock def put_notification_configuration(auto_scaling_group_name, notification_types, topic_arn) - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) raise Fog::AWS::AutoScaling::ValidationError.new("AutoScalingGroup name not found - #{auto_scaling_group_name}") end if notification_types.to_a.empty? diff --git a/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb b/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb index dda0a1323..f73c1b459 100644 --- a/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +++ b/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb @@ -52,7 +52,7 @@ module Fog class Mock def put_scaling_policy(adjustment_type, auto_scaling_group_name, policy_name, scaling_adjustment, options = {}) - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) raise Fog::AWS::AutoScaling::ValidationError.new('Auto Scaling Group name not found - null') end self.data[:scaling_policies][policy_name] = { diff --git a/lib/fog/aws/requests/auto_scaling/resume_processes.rb b/lib/fog/aws/requests/auto_scaling/resume_processes.rb index d570b6ed1..0356221e0 100644 --- a/lib/fog/aws/requests/auto_scaling/resume_processes.rb +++ b/lib/fog/aws/requests/auto_scaling/resume_processes.rb @@ -36,7 +36,7 @@ module Fog class Mock def resume_processes(auto_scaling_group_name, options = {}) - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) raise Fog::AWS::AutoScaling::ValidationError.new("AutoScalingGroup name not found - no such group: #{auto_scaling_group_name}") end diff --git a/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb b/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb index 6c3ce6b55..b7c11be89 100644 --- a/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb +++ b/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb @@ -63,7 +63,7 @@ module Fog class Mock def set_desired_capacity(auto_scaling_group_name, desired_capacity, options = {}) - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null') end self.data[:auto_scaling_groups][auto_scaling_group_name]['DesiredCapacity'] = desired_capacity diff --git a/lib/fog/aws/requests/auto_scaling/suspend_processes.rb b/lib/fog/aws/requests/auto_scaling/suspend_processes.rb index eae54ddcc..7dcd419de 100644 --- a/lib/fog/aws/requests/auto_scaling/suspend_processes.rb +++ b/lib/fog/aws/requests/auto_scaling/suspend_processes.rb @@ -39,7 +39,7 @@ module Fog class Mock def suspend_processes(auto_scaling_group_name, options = {}) - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) raise Fog::AWS::AutoScaling::ValidationError.new("AutoScalingGroup name not found - no such group: #{auto_scaling_group_name}") end diff --git a/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb b/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb index 0efcbd220..5a53fc86c 100644 --- a/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +++ b/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb @@ -75,7 +75,7 @@ module Fog raise Fog::AWS::AutoScaling::ValidationError.new("Options #{unexpected_options.join(',')} should not be included in request") end - unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name) raise Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null') end self.data[:auto_scaling_groups][auto_scaling_group_name].merge!(options) diff --git a/lib/fog/aws/requests/cloud_watch/delete_alarms.rb b/lib/fog/aws/requests/cloud_watch/delete_alarms.rb index 542450ea8..3784e1eeb 100644 --- a/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +++ b/lib/fog/aws/requests/cloud_watch/delete_alarms.rb @@ -28,7 +28,7 @@ module Fog class Mock def delete_alarms(alarm_names) [*alarm_names].each do |alarm_name| - unless data[:metric_alarms].has_key?(alarm_name) + unless data[:metric_alarms].key?(alarm_name) raise Fog::AWS::AutoScaling::NotFound, "The alarm '#{alarm_name}' does not exist." end end diff --git a/lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb b/lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb index c54118945..dbfcfef7d 100644 --- a/lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb +++ b/lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb @@ -25,7 +25,7 @@ module Fog # def get_metric_statistics(options={}) %w{Statistics StartTime EndTime Period MetricName Namespace}.each do |required_parameter| - raise ArgumentError, "Must provide #{required_parameter}" unless options.has_key?(required_parameter) + raise ArgumentError, "Must provide #{required_parameter}" unless options.key?(required_parameter) end statistics = options.delete 'Statistics' options.merge!(AWS.indexed_param('Statistics.member.%d', [*statistics])) diff --git a/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb b/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb index f4f9c7f09..f15979006 100644 --- a/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +++ b/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb @@ -66,7 +66,7 @@ module Fog requirements = [ "AlarmName", "ComparisonOperator", "EvaluationPeriods", "Namespace", "Period", "Statistic", "Threshold" ] requirements.each do |req| - unless options.has_key?(req) + unless options.key?(req) raise Fog::Compute::AWS::Error.new("The request must contain a the parameter '%s'" % req) end end diff --git a/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb b/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb index 773cc359e..1ded41dc6 100644 --- a/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +++ b/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb @@ -138,7 +138,7 @@ module Fog if !is_vpc && (options['IpProtocol'] && (!options['FromPort'] || !options['ToPort'])) raise Fog::Compute::AWS::Error.new("InvalidPermission.Malformed => TCP/UDP port (-1) out of range") end - if options.has_key?('IpPermissions') + if options.key?('IpPermissions') if !options['IpPermissions'].is_a?(Array) || options['IpPermissions'].empty? raise Fog::Compute::AWS::Error.new("InvalidRequest => The request received was invalid.") end diff --git a/lib/fog/aws/requests/compute/delete_tags.rb b/lib/fog/aws/requests/compute/delete_tags.rb index 2c97bbc16..44ad01409 100644 --- a/lib/fog/aws/requests/compute/delete_tags.rb +++ b/lib/fog/aws/requests/compute/delete_tags.rb @@ -65,7 +65,7 @@ module Fog tagged.each do |resource| tags.each do |key, value| tagset = self.data[:tag_sets][resource['resourceId']] - tagset.delete(key) if tagset.has_key?(key) && (value.nil? || tagset[key] == value) + tagset.delete(key) if tagset.key?(key) && (value.nil? || tagset[key] == value) end end diff --git a/lib/fog/aws/requests/compute/describe_snapshots.rb b/lib/fog/aws/requests/compute/describe_snapshots.rb index 3913b5b2d..dca6cda86 100644 --- a/lib/fog/aws/requests/compute/describe_snapshots.rb +++ b/lib/fog/aws/requests/compute/describe_snapshots.rb @@ -35,7 +35,7 @@ module Fog end for key in ['ExecutableBy', 'ImageId', 'Owner', 'RestorableBy'] - if filters.has_key?(key) + if filters.key?(key) options[key] = filters.delete(key) end end diff --git a/lib/fog/aws/requests/elb/create_load_balancer.rb b/lib/fog/aws/requests/elb/create_load_balancer.rb index e89bd869c..c9c4b9bfb 100644 --- a/lib/fog/aws/requests/elb/create_load_balancer.rb +++ b/lib/fog/aws/requests/elb/create_load_balancer.rb @@ -60,7 +60,7 @@ module Fog response = Excon::Response.new response.status = 200 - raise Fog::AWS::ELB::IdentifierTaken if self.data[:load_balancers].has_key? lb_name + raise Fog::AWS::ELB::IdentifierTaken if self.data[:load_balancers].key? lb_name certificate_ids = Fog::AWS::IAM::Mock.data[@aws_access_key_id][:server_certificates].map {|n, c| c['Arn'] } diff --git a/lib/fog/aws/requests/iam/add_user_to_group.rb b/lib/fog/aws/requests/iam/add_user_to_group.rb index 400efefc3..66a58f026 100644 --- a/lib/fog/aws/requests/iam/add_user_to_group.rb +++ b/lib/fog/aws/requests/iam/add_user_to_group.rb @@ -30,8 +30,8 @@ module Fog class Mock def add_user_to_group(group_name, user_name) - if data[:groups].has_key? group_name - if data[:users].has_key? user_name + if data[:groups].key? group_name + if data[:users].key? user_name unless data[:groups][group_name][:members].include?(user_name) data[:groups][group_name][:members] << user_name diff --git a/lib/fog/aws/requests/iam/create_access_key.rb b/lib/fog/aws/requests/iam/create_access_key.rb index 2ebaa96b2..fe189c690 100644 --- a/lib/fog/aws/requests/iam/create_access_key.rb +++ b/lib/fog/aws/requests/iam/create_access_key.rb @@ -35,7 +35,7 @@ module Fog #FIXME: Not 100% correct as AWS will use the signing credentials when there is no 'UserName' in the options hash # Also doesn't raise an error when there are too many keys if user = options['UserName'] - if data[:users].has_key? user + if data[:users].key? user access_keys_data = data[:users][user][:access_keys] else raise Fog::AWS::IAM::NotFound.new('The user with name #{user_name} cannot be found.') diff --git a/lib/fog/aws/requests/iam/create_group.rb b/lib/fog/aws/requests/iam/create_group.rb index 47bf6743e..3a3b5dc16 100644 --- a/lib/fog/aws/requests/iam/create_group.rb +++ b/lib/fog/aws/requests/iam/create_group.rb @@ -35,7 +35,7 @@ module Fog class Mock def create_group(group_name, path = '/') - if data[:groups].has_key? group_name + if data[:groups].key? group_name raise Fog::AWS::IAM::EntityAlreadyExists.new("Group with name #{group_name} already exists.") else data[:groups][group_name][:path] = path diff --git a/lib/fog/aws/requests/iam/create_user.rb b/lib/fog/aws/requests/iam/create_user.rb index 48c87a1b6..a4b6b949d 100644 --- a/lib/fog/aws/requests/iam/create_user.rb +++ b/lib/fog/aws/requests/iam/create_user.rb @@ -35,7 +35,7 @@ module Fog class Mock def create_user(user_name, path='/') - if data[:users].has_key? user_name + if data[:users].key? user_name raise Fog::AWS::IAM::EntityAlreadyExists.new "User with name #{user_name} already exists." else data[:users][user_name][:path] = path diff --git a/lib/fog/aws/requests/iam/delete_access_key.rb b/lib/fog/aws/requests/iam/delete_access_key.rb index 458b5fb75..9beba0005 100644 --- a/lib/fog/aws/requests/iam/delete_access_key.rb +++ b/lib/fog/aws/requests/iam/delete_access_key.rb @@ -31,7 +31,7 @@ module Fog class Mock def delete_access_key(access_key_id, options = {}) user_name = options['UserName'] - if user_name && data[:users].has_key?(user_name) && data[:users][user_name][:access_keys].any? { |akey| akey['AccessKeyId'] == access_key_id } + if user_name && data[:users].key?(user_name) && data[:users][user_name][:access_keys].any? { |akey| akey['AccessKeyId'] == access_key_id } data[:users][user_name][:access_keys].delete_if { |akey| akey['AccessKeyId'] == access_key_id } Excon::Response.new.tap do |response| response.body = { 'RequestId' => Fog::AWS::Mock.request_id } diff --git a/lib/fog/aws/requests/iam/delete_group.rb b/lib/fog/aws/requests/iam/delete_group.rb index cbac34b79..93ba12bbe 100644 --- a/lib/fog/aws/requests/iam/delete_group.rb +++ b/lib/fog/aws/requests/iam/delete_group.rb @@ -28,7 +28,7 @@ module Fog class Mock def delete_group(group_name) - if data[:groups].has_key? group_name + if data[:groups].key? group_name if data[:groups][group_name][:members].empty? data[:groups].delete group_name Excon::Response.new.tap do |response| diff --git a/lib/fog/aws/requests/iam/delete_user.rb b/lib/fog/aws/requests/iam/delete_user.rb index 7f3621ab8..833520b2e 100644 --- a/lib/fog/aws/requests/iam/delete_user.rb +++ b/lib/fog/aws/requests/iam/delete_user.rb @@ -28,7 +28,7 @@ module Fog class Mock def delete_user(user_name) - if data[:users].has_key? user_name + if data[:users].key? user_name data[:users].delete user_name Excon::Response.new.tap do |response| response.body = { 'RequestId' => Fog::AWS::Mock.request_id } diff --git a/lib/fog/aws/requests/iam/delete_user_policy.rb b/lib/fog/aws/requests/iam/delete_user_policy.rb index 3acb5c4e4..a12ba93e6 100644 --- a/lib/fog/aws/requests/iam/delete_user_policy.rb +++ b/lib/fog/aws/requests/iam/delete_user_policy.rb @@ -30,7 +30,7 @@ module Fog class Mock def delete_user_policy(user_name, policy_name) - if data[:users].has_key?(user_name) && data[:users][user_name][:policies].has_key?(policy_name) + if data[:users].key?(user_name) && data[:users][user_name][:policies].key?(policy_name) data[:users][user_name][:policies].delete policy_name Excon::Response.new.tap do |response| response.body = { 'RequestId' => Fog::AWS::Mock.request_id } diff --git a/lib/fog/aws/requests/iam/list_access_keys.rb b/lib/fog/aws/requests/iam/list_access_keys.rb index 5dec3fa5b..6c42cfc2c 100644 --- a/lib/fog/aws/requests/iam/list_access_keys.rb +++ b/lib/fog/aws/requests/iam/list_access_keys.rb @@ -38,7 +38,7 @@ module Fog def list_access_keys(options = {}) #FIXME: Doesn't do anything with options, aside from UserName if user = options['UserName'] - if data[:users].has_key? user + if data[:users].key? user access_keys_data = data[:users][user][:access_keys] else raise Fog::AWS::IAM::NotFound.new("The user with name #{user} cannot be found.") diff --git a/lib/fog/aws/requests/iam/list_groups_for_user.rb b/lib/fog/aws/requests/iam/list_groups_for_user.rb index 7bd5bd0c7..d5b72a565 100644 --- a/lib/fog/aws/requests/iam/list_groups_for_user.rb +++ b/lib/fog/aws/requests/iam/list_groups_for_user.rb @@ -40,7 +40,7 @@ module Fog class Mock def list_groups_for_user(user_name, options = {}) #FIXME: Does not consider options - if data[:users].has_key? user_name + if data[:users].key? user_name Excon::Response.new.tap do |response| response.status = 200 response.body = { 'GroupsForUser' => data[:groups].select do |name, group| diff --git a/lib/fog/aws/requests/iam/list_user_policies.rb b/lib/fog/aws/requests/iam/list_user_policies.rb index 1962a71ac..261543c1e 100644 --- a/lib/fog/aws/requests/iam/list_user_policies.rb +++ b/lib/fog/aws/requests/iam/list_user_policies.rb @@ -36,7 +36,7 @@ module Fog class Mock def list_user_policies(user_name, options = {}) #FIXME: doesn't use options atm - if data[:users].has_key? user_name + if data[:users].key? user_name Excon::Response.new.tap do |response| response.body = { 'PolicyNames' => data[:users][user_name][:policies].keys, 'IsTruncated' => false, diff --git a/lib/fog/aws/requests/iam/put_group_policy.rb b/lib/fog/aws/requests/iam/put_group_policy.rb index 4d6462555..adebc168a 100644 --- a/lib/fog/aws/requests/iam/put_group_policy.rb +++ b/lib/fog/aws/requests/iam/put_group_policy.rb @@ -33,7 +33,7 @@ module Fog #FIXME: You can't actually use the credentials for anything elsewhere in Fog #FIXME: Doesn't do any validation on the policy def put_group_policy(group_name, policy_name, policy_document) - if data[:groups].has_key? group_name + if data[:groups].key? group_name data[:groups][group_name][:policies][policy_name] = policy_document Excon::Response.new.tap do |response| diff --git a/lib/fog/aws/requests/iam/put_user_policy.rb b/lib/fog/aws/requests/iam/put_user_policy.rb index a9c03693a..4ca089c3e 100644 --- a/lib/fog/aws/requests/iam/put_user_policy.rb +++ b/lib/fog/aws/requests/iam/put_user_policy.rb @@ -34,7 +34,7 @@ module Fog #FIXME: You can't actually use the credentials for anything elsewhere in Fog #FIXME: Doesn't do any validation on the policy def put_user_policy(user_name, policy_name, policy_document) - if data[:users].has_key? user_name + if data[:users].key? user_name data[:users][user_name][:policies][policy_name] = policy_document Excon::Response.new.tap do |response| diff --git a/lib/fog/aws/requests/iam/remove_user_from_group.rb b/lib/fog/aws/requests/iam/remove_user_from_group.rb index aa512c0b6..f7b89ca84 100644 --- a/lib/fog/aws/requests/iam/remove_user_from_group.rb +++ b/lib/fog/aws/requests/iam/remove_user_from_group.rb @@ -30,8 +30,8 @@ module Fog class Mock def remove_user_from_group(group_name, user_name) - if data[:groups].has_key? group_name - if data[:users].has_key? user_name + if data[:groups].key? group_name + if data[:users].key? user_name data[:groups][group_name][:members].delete_if { |item| item == user_name } Excon::Response.new.tap do |response| response.status = 200 diff --git a/lib/fog/aws/requests/iam/update_access_key.rb b/lib/fog/aws/requests/iam/update_access_key.rb index 3e883a34f..4e84cba04 100644 --- a/lib/fog/aws/requests/iam/update_access_key.rb +++ b/lib/fog/aws/requests/iam/update_access_key.rb @@ -33,7 +33,7 @@ module Fog class Mock def update_access_key(access_key_id, status, options = {}) if user = options['UserName'] - if data[:users].has_key? user + if data[:users].key? user access_keys_data = data[:users][user][:access_keys] else raise Fog::AWS::IAM::NotFound.new('The user with name #{user_name} cannot be found.') diff --git a/lib/fog/aws/requests/rds/create_db_instance.rb b/lib/fog/aws/requests/rds/create_db_instance.rb index ae5a63fff..3bfd66663 100644 --- a/lib/fog/aws/requests/rds/create_db_instance.rb +++ b/lib/fog/aws/requests/rds/create_db_instance.rb @@ -66,7 +66,7 @@ module Fog # These are the required parameters according to the API required_params = %w{AllocatedStorage DBInstanceClass Engine MasterUserPassword MasterUsername } required_params.each do |key| - unless options.has_key?(key) and options[key] and !options[key].to_s.empty? + unless options.key?(key) and options[key] and !options[key].to_s.empty? #response.status = 400 #response.body = { # 'Code' => 'MissingParameter', diff --git a/lib/fog/aws/requests/ses/send_email.rb b/lib/fog/aws/requests/ses/send_email.rb index a08e16fed..1d247cfa9 100644 --- a/lib/fog/aws/requests/ses/send_email.rb +++ b/lib/fog/aws/requests/ses/send_email.rb @@ -52,11 +52,11 @@ module Fog end end - if options.has_key?('ReplyToAddresses') + if options.key?('ReplyToAddresses') params.merge!(Fog::AWS.indexed_param("ReplyToAddresses.member", [*options['ReplyToAddresses']])) end - if options.has_key?('ReturnPath') + if options.key?('ReturnPath') params['ReturnPath'] = options['ReturnPath'] end diff --git a/lib/fog/aws/requests/ses/send_raw_email.rb b/lib/fog/aws/requests/ses/send_raw_email.rb index e998dd7fa..1a9265471 100644 --- a/lib/fog/aws/requests/ses/send_raw_email.rb +++ b/lib/fog/aws/requests/ses/send_raw_email.rb @@ -20,10 +20,10 @@ module Fog # * 'RequestId'<~String> - Id of request def send_raw_email(raw_message, options = {}) params = {} - if options.has_key?('Destinations') + if options.key?('Destinations') params.merge!(Fog::AWS.indexed_param('Destinations.member', [*options['Destinations']])) end - if options.has_key?('Source') + if options.key?('Source') params['Source'] = options['Source'] end diff --git a/lib/fog/aws/requests/simpledb/get_attributes.rb b/lib/fog/aws/requests/simpledb/get_attributes.rb index da66f6ae1..e0a911363 100644 --- a/lib/fog/aws/requests/simpledb/get_attributes.rb +++ b/lib/fog/aws/requests/simpledb/get_attributes.rb @@ -55,7 +55,7 @@ module Fog object = {} if !options['AttributeName'].empty? for attribute in options['AttributeName'] - if self.data[:domains][domain_name].has_key?(item_name) && self.data[:domains][domain_name][item_name].has_key?(attribute) + if self.data[:domains][domain_name].key?(item_name) && self.data[:domains][domain_name][item_name].key?(attribute) object[attribute] = self.data[:domains][domain_name][item_name][attribute] end end diff --git a/lib/fog/aws/requests/sqs/change_message_visibility.rb b/lib/fog/aws/requests/sqs/change_message_visibility.rb index 475a180a2..c74806795 100644 --- a/lib/fog/aws/requests/sqs/change_message_visibility.rb +++ b/lib/fog/aws/requests/sqs/change_message_visibility.rb @@ -31,7 +31,7 @@ module Fog Excon::Response.new.tap do |response| if (queue = data[:queues][queue_url]) message_id, _ = queue[:receipt_handles].find { |message_id, receipts| - receipts.has_key?(receipt_handle) + receipts.key?(receipt_handle) } if message_id diff --git a/lib/fog/aws/requests/sqs/delete_message.rb b/lib/fog/aws/requests/sqs/delete_message.rb index 34d4e7716..e1a2b873e 100644 --- a/lib/fog/aws/requests/sqs/delete_message.rb +++ b/lib/fog/aws/requests/sqs/delete_message.rb @@ -29,7 +29,7 @@ module Fog Excon::Response.new.tap do |response| if (queue = data[:queues][queue_url]) message_id, _ = queue[:receipt_handles].find { |msg_id, receipts| - receipts.has_key?(receipt_handle) + receipts.key?(receipt_handle) } if message_id diff --git a/lib/fog/aws/requests/storage/acl_utils.rb b/lib/fog/aws/requests/storage/acl_utils.rb index 7585bd4fe..61902f999 100644 --- a/lib/fog/aws/requests/storage/acl_utils.rb +++ b/lib/fog/aws/requests/storage/acl_utils.rb @@ -21,11 +21,11 @@ module Fog data << " \n" grantee = grant['Grantee'] type = case - when grantee.has_key?('ID') + when grantee.key?('ID') 'CanonicalUser' - when grantee.has_key?('EmailAddress') + when grantee.key?('EmailAddress') 'AmazonCustomerByEmail' - when grantee.has_key?('URI') + when grantee.key?('URI') 'Group' end diff --git a/lib/fog/aws/requests/storage/get_bucket.rb b/lib/fog/aws/requests/storage/get_bucket.rb index 458fc6b8d..266e428ee 100644 --- a/lib/fog/aws/requests/storage/get_bucket.rb +++ b/lib/fog/aws/requests/storage/get_bucket.rb @@ -68,7 +68,7 @@ module Fog (marker && object['Key'] <= marker) || (delimiter && object['Key'][(prefix ? prefix.length : 0)..-1].include?(delimiter) \ && common_prefixes << object['Key'].sub(/^(#{prefix}[^#{delimiter}]+.).*/, '\1')) || - object.has_key?(:delete_marker) + object.key?(:delete_marker) end.map do |object| data = object.reject {|key, value| !['ETag', 'Key', 'StorageClass'].include?(key)} data.merge!({ diff --git a/lib/fog/aws/requests/storage/get_bucket_object_versions.rb b/lib/fog/aws/requests/storage/get_bucket_object_versions.rb index 125331b63..11ba690cf 100644 --- a/lib/fog/aws/requests/storage/get_bucket_object_versions.rb +++ b/lib/fog/aws/requests/storage/get_bucket_object_versions.rb @@ -98,7 +98,7 @@ module Fog (delimiter && object['Key'][(prefix ? prefix.length : 0)..-1].include?(delimiter) \ && common_prefixes << object['Key'].sub(/^(#{prefix}[^#{delimiter}]+.).*/, '\1')) end.map do |object| - if object.has_key?(:delete_marker) + if object.key?(:delete_marker) tag_name = 'DeleteMarker' extracted_attrs = ['Key', 'VersionId'] else diff --git a/lib/fog/aws/requests/storage/get_object.rb b/lib/fog/aws/requests/storage/get_object.rb index f1f461898..4aee509bc 100644 --- a/lib/fog/aws/requests/storage/get_object.rb +++ b/lib/fog/aws/requests/storage/get_object.rb @@ -77,7 +77,7 @@ module Fog response = Excon::Response.new if (bucket = self.data[:buckets][bucket_name]) object = nil - if bucket[:objects].has_key?(object_name) + if bucket[:objects].key?(object_name) object = version_id ? bucket[:objects][object_name].find { |object| object['VersionId'] == version_id} : bucket[:objects][object_name].first end diff --git a/lib/fog/bluebox/requests/compute/create_block.rb b/lib/fog/bluebox/requests/compute/create_block.rb index 494ad5800..0070685e9 100644 --- a/lib/fog/bluebox/requests/compute/create_block.rb +++ b/lib/fog/bluebox/requests/compute/create_block.rb @@ -18,7 +18,7 @@ module Fog # * response<~Excon::Response>: # * body<~Hash>: def create_block(product_id, template_id, location_id, options = {}) - unless options.has_key?('password') || options.has_key?('ssh_public_key') + unless options.key?('password') || options.key?('ssh_public_key') raise ArgumentError, 'Either password or public_key must be supplied' end diff --git a/lib/fog/dnsimple/requests/dns/get_record.rb b/lib/fog/dnsimple/requests/dns/get_record.rb index d53b50a39..24b9e5944 100644 --- a/lib/fog/dnsimple/requests/dns/get_record.rb +++ b/lib/fog/dnsimple/requests/dns/get_record.rb @@ -25,7 +25,7 @@ module Fog def get_record(domain, record_id) response = Excon::Response.new - if self.data[:records].has_key?(domain) + if self.data[:records].key?(domain) response.status = 200 response.body = self.data[:records][domain].find { |record| record["record"]["id"] == record_id } diff --git a/lib/fog/ecloud/compute.rb b/lib/fog/ecloud/compute.rb index c45ec2372..6cf51694d 100644 --- a/lib/fog/ecloud/compute.rb +++ b/lib/fog/ecloud/compute.rb @@ -251,7 +251,7 @@ module Fog attr_reader :versions_uri def validate_data(required_opts = [], options = {}) - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end end @@ -810,7 +810,7 @@ module Fog status = params[:status] || 200 response = Excon::Response.new(:body => body, :headers => headers, :status => status) - if params.has_key?(:expects) && ![*params[:expects]].include?(response.status) + if params.key?(:expects) && ![*params[:expects]].include?(response.status) raise(Excon::Errors.status_error(params, response)) else response end diff --git a/lib/fog/ecloud/requests/compute/compute_pool_edit.rb b/lib/fog/ecloud/requests/compute/compute_pool_edit.rb index 8b797e607..bc4af184b 100644 --- a/lib/fog/ecloud/requests/compute/compute_pool_edit.rb +++ b/lib/fog/ecloud/requests/compute/compute_pool_edit.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_edit_compute_pool_options(options) required_opts = [:name] - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/ecloud/requests/compute/internet_service_create.rb b/lib/fog/ecloud/requests/compute/internet_service_create.rb index 9fccd41a9..ef30e50eb 100644 --- a/lib/fog/ecloud/requests/compute/internet_service_create.rb +++ b/lib/fog/ecloud/requests/compute/internet_service_create.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_internet_service_data(service_data) required_opts = [:name, :protocol, :port, :description, :enabled, :persistence] - unless required_opts.all? { |opt| service_data.has_key?(opt) } + unless required_opts.all? { |opt| service_data.key?(opt) } raise ArgumentError.new("Required Internet Service data missing: #{(required_opts - service_data.keys).map(&:inspect).join(", ")}") end if service_data[:trusted_network_group] diff --git a/lib/fog/ecloud/requests/compute/internet_service_edit.rb b/lib/fog/ecloud/requests/compute/internet_service_edit.rb index 9ea840e54..ab9fe1ec8 100644 --- a/lib/fog/ecloud/requests/compute/internet_service_edit.rb +++ b/lib/fog/ecloud/requests/compute/internet_service_edit.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_edit_internet_service_options(options) required_opts = [:name, :enabled, :persistence] - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end raise ArgumentError.new("Required data missing: #{:persistence[:type]}") unless options[:persistence][:type] diff --git a/lib/fog/ecloud/requests/compute/node_service_create.rb b/lib/fog/ecloud/requests/compute/node_service_create.rb index a2d44d314..6ce4ad745 100644 --- a/lib/fog/ecloud/requests/compute/node_service_create.rb +++ b/lib/fog/ecloud/requests/compute/node_service_create.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_node_service_data(service_data) required_opts = [:name, :port, :enabled, :ip_address] - unless required_opts.all? { |opt| service_data.has_key?(opt) } + unless required_opts.all? { |opt| service_data.key?(opt) } raise ArgumentError.new("Required Internet Service data missing: #{(required_opts - service_data.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/ecloud/requests/compute/node_service_edit.rb b/lib/fog/ecloud/requests/compute/node_service_edit.rb index 165074cef..ddb3011d6 100644 --- a/lib/fog/ecloud/requests/compute/node_service_edit.rb +++ b/lib/fog/ecloud/requests/compute/node_service_edit.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_edit_node_service_options(options) required_opts = [:name, :enabled] - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/ecloud/requests/compute/virtual_machine_copy.rb b/lib/fog/ecloud/requests/compute/virtual_machine_copy.rb index a78147874..0cc06d4db 100644 --- a/lib/fog/ecloud/requests/compute/virtual_machine_copy.rb +++ b/lib/fog/ecloud/requests/compute/virtual_machine_copy.rb @@ -9,7 +9,7 @@ module Fog else required_opts.push(:ssh_key_uri) end - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end diff --git a/lib/fog/ecloud/requests/compute/virtual_machine_copy_identical.rb b/lib/fog/ecloud/requests/compute/virtual_machine_copy_identical.rb index fadcfe88d..d47a02480 100644 --- a/lib/fog/ecloud/requests/compute/virtual_machine_copy_identical.rb +++ b/lib/fog/ecloud/requests/compute/virtual_machine_copy_identical.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_create_server_options_identical(template_uri, options) required_opts = [:name, :row, :group, :source] - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end diff --git a/lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb b/lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb index 7999ada4e..dd0df5572 100644 --- a/lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb +++ b/lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb @@ -9,7 +9,7 @@ module Fog else required_opts.push(:ssh_key_uri) end - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end diff --git a/lib/fog/ecloud/requests/compute/virtual_machine_edit.rb b/lib/fog/ecloud/requests/compute/virtual_machine_edit.rb index 524594cd5..de08b7050 100644 --- a/lib/fog/ecloud/requests/compute/virtual_machine_edit.rb +++ b/lib/fog/ecloud/requests/compute/virtual_machine_edit.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_edit_server_options(options) required_opts = [:name] - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/ecloud/requests/compute/virtual_machine_import.rb b/lib/fog/ecloud/requests/compute/virtual_machine_import.rb index 5912392fd..64ad7d139 100644 --- a/lib/fog/ecloud/requests/compute/virtual_machine_import.rb +++ b/lib/fog/ecloud/requests/compute/virtual_machine_import.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_import_server_options(template_uri, options) required_opts = [:name, :cpus, :memory, :row, :group, :network_uri, :catalog_network_name] - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end diff --git a/lib/fog/ecloud/requests/compute/virtual_machine_upload_file.rb b/lib/fog/ecloud/requests/compute/virtual_machine_upload_file.rb index 80de4ef03..ed57cae84 100644 --- a/lib/fog/ecloud/requests/compute/virtual_machine_upload_file.rb +++ b/lib/fog/ecloud/requests/compute/virtual_machine_upload_file.rb @@ -4,7 +4,7 @@ module Fog module Shared def validate_upload_file_options(options) required_opts = [:file, :path, :credentials] - unless required_opts.all? { |opt| options.has_key?(opt) } + unless required_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/fogdocker/requests/compute/container_action.rb b/lib/fog/fogdocker/requests/compute/container_action.rb index 718b387d6..c4d8c1561 100644 --- a/lib/fog/fogdocker/requests/compute/container_action.rb +++ b/lib/fog/fogdocker/requests/compute/container_action.rb @@ -3,8 +3,8 @@ module Fog class Fogdocker class Real def container_action(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id - raise ArgumentError, "action is a required parameter" unless options.has_key? :action + raise ArgumentError, "instance id is a required parameter" unless options.key? :id + raise ArgumentError, "action is a required parameter" unless options.key? :action container = Docker::Container.get(options[:id]) downcase_hash_keys container.send(options[:action]).json end @@ -12,8 +12,8 @@ module Fog class Mock def container_action(options = {}) - raise ArgumentError, "id is a required parameter" unless options.has_key? :id - raise ArgumentError, "action is a required parameter" unless options.has_key? :action + raise ArgumentError, "id is a required parameter" unless options.key? :id + raise ArgumentError, "action is a required parameter" unless options.key? :action {'id' => 'a6b02c7ca29a22619f7d0e59062323247739bc0cd375d619f305f0b519af4ef3','state_running' => false} end end diff --git a/lib/fog/fogdocker/requests/compute/container_commit.rb b/lib/fog/fogdocker/requests/compute/container_commit.rb index 6eb2a0b59..2d1b830fb 100644 --- a/lib/fog/fogdocker/requests/compute/container_commit.rb +++ b/lib/fog/fogdocker/requests/compute/container_commit.rb @@ -3,7 +3,7 @@ module Fog class Fogdocker class Real def container_commit(options) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id + raise ArgumentError, "instance id is a required parameter" unless options.key? :id container = Docker::Container.get(options[:id]) downcase_hash_keys container.commit(camelize_hash_keys(options)).json end diff --git a/lib/fog/fogdocker/requests/compute/container_delete.rb b/lib/fog/fogdocker/requests/compute/container_delete.rb index 9b7b30e0c..8526524b7 100644 --- a/lib/fog/fogdocker/requests/compute/container_delete.rb +++ b/lib/fog/fogdocker/requests/compute/container_delete.rb @@ -3,7 +3,7 @@ module Fog class Fogdocker class Real def container_delete(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id + raise ArgumentError, "instance id is a required parameter" unless options.key? :id container = Docker::Container.get(options[:id]) container.delete() true @@ -12,7 +12,7 @@ module Fog class Mock def container_delete(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id + raise ArgumentError, "instance id is a required parameter" unless options.key? :id true end end diff --git a/lib/fog/fogdocker/requests/compute/image_delete.rb b/lib/fog/fogdocker/requests/compute/image_delete.rb index 32198f647..d5038f753 100644 --- a/lib/fog/fogdocker/requests/compute/image_delete.rb +++ b/lib/fog/fogdocker/requests/compute/image_delete.rb @@ -3,7 +3,7 @@ module Fog class Fogdocker class Real def image_delete(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id + raise ArgumentError, "instance id is a required parameter" unless options.key? :id image = Docker::Image.get(options[:id]) image.remove() end @@ -11,7 +11,7 @@ module Fog class Mock def image_delete(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id + raise ArgumentError, "instance id is a required parameter" unless options.key? :id "[{'Deleted':'b15c1423ba157d0f7ac83cba178390c421bb8d536e7e7857580fc10f2d53e1b9'}]" end end diff --git a/lib/fog/glesys/models/compute/ips.rb b/lib/fog/glesys/models/compute/ips.rb index b242f34c6..cca8e20f3 100644 --- a/lib/fog/glesys/models/compute/ips.rb +++ b/lib/fog/glesys/models/compute/ips.rb @@ -43,7 +43,7 @@ module Fog options = default_options.merge!(options) %w{platform datacenter version}.each do |attr| - raise Fog::Errors::Error.new("You need to specify ':#{attr}'") if !options.has_key?(attr.to_sym) + raise Fog::Errors::Error.new("You need to specify ':#{attr}'") if !options.key?(attr.to_sym) end options[:ipversion] = options[:version] diff --git a/lib/fog/google/models/compute/addresses.rb b/lib/fog/google/models/compute/addresses.rb index 074bb15b3..33bf30f0a 100755 --- a/lib/fog/google/models/compute/addresses.rb +++ b/lib/fog/google/models/compute/addresses.rb @@ -29,7 +29,7 @@ module Fog def get_by_ip_address(ip_address) addresses = service.list_aggregated_addresses(:filter => "address eq .*#{ip_address}").body['items'] - address = addresses.each_value.select { |region| region.has_key?('addresses') } + address = addresses.each_value.select { |region| region.key?('addresses') } return nil if address.empty? new(address.first['addresses'].first) diff --git a/lib/fog/google/models/compute/disks.rb b/lib/fog/google/models/compute/disks.rb index 00705b19d..98658a962 100644 --- a/lib/fog/google/models/compute/disks.rb +++ b/lib/fog/google/models/compute/disks.rb @@ -25,7 +25,7 @@ module Fog response = service.get_disk(identity, zone).body else disks = service.list_aggregated_disks(:filter => "name eq .*#{identity}").body['items'] - disk = disks.each_value.select { |zone| zone.has_key?('disks') } + disk = disks.each_value.select { |zone| zone.key?('disks') } # It can only be 1 disk with the same name across all regions response = disk.first['disks'].first unless disk.empty? diff --git a/lib/fog/google/models/compute/servers.rb b/lib/fog/google/models/compute/servers.rb index 9bb401fec..cbe80290a 100644 --- a/lib/fog/google/models/compute/servers.rb +++ b/lib/fog/google/models/compute/servers.rb @@ -25,7 +25,7 @@ module Fog response = service.get_server(identity, zone).body else servers = service.list_aggregated_servers(:filter => "name eq .*#{identity}").body['items'] - server = servers.each_value.select { |zone| zone.has_key?('instances') } + server = servers.each_value.select { |zone| zone.key?('instances') } # It can only be 1 server with the same name across all regions response = server.first['instances'].first unless server.empty? diff --git a/lib/fog/google/requests/compute/insert_disk.rb b/lib/fog/google/requests/compute/insert_disk.rb index a660ea45f..90ae36a35 100644 --- a/lib/fog/google/requests/compute/insert_disk.rb +++ b/lib/fog/google/requests/compute/insert_disk.rb @@ -81,12 +81,12 @@ module Fog # sizeGb or sourceSnapshot need to be present, one will create blank # disk of desired size, other will create disk from snapshot if image_name.nil? - if opts.has_key?('sourceSnapshot') + if opts.key?('sourceSnapshot') # New disk from snapshot snap = snapshots.get(opts.delete('sourceSnapshot')) raise ArgumentError.new('Invalid source snapshot') unless snap body_object['sourceSnapshot'] = @api_url + snap.resource_url - elsif opts.has_key?('sizeGb') + elsif opts.key?('sizeGb') # New blank disk body_object['sizeGb'] = opts.delete('sizeGb') else diff --git a/lib/fog/google/requests/compute/insert_server.rb b/lib/fog/google/requests/compute/insert_server.rb index b6dbb6fa0..b453a98d2 100644 --- a/lib/fog/google/requests/compute/insert_server.rb +++ b/lib/fog/google/requests/compute/insert_server.rb @@ -128,7 +128,7 @@ module Fog body_object['machineType'] = @api_url + @project + "/zones/#{zone_name}/machineTypes/#{options.delete 'machineType'}" network = nil - if options.has_key? 'network' + if options.key? 'network' network = options.delete 'network' elsif @default_network network = @default_network @@ -137,7 +137,7 @@ module Fog # ExternalIP is default value for server creation access_config = {'type' => 'ONE_TO_ONE_NAT', 'name' => 'External NAT'} # leave natIP undefined to use an IP from a shared ephemeral IP address pool - if options.has_key? 'externalIp' + if options.key? 'externalIp' access_config['natIP'] = options.delete 'externalIp' # If set to 'false', that would mean user does no want to allocate an external IP access_config = nil if access_config['natIP'] == false @@ -154,11 +154,11 @@ module Fog 'automaticRestart' => false, 'onHostMaintenance' => "MIGRATE" } - if options.has_key? 'auto_restart' + if options.key? 'auto_restart' scheduling['automaticRestart'] = options.delete 'auto_restart' scheduling['automaticRestart'] = scheduling['automaticRestart'].class == TrueClass end - if options.has_key? 'on_host_maintenance' + if options.key? 'on_host_maintenance' ohm = options.delete 'on_host_maintenance' scheduling['onHostMaintenance'] = (ohm.respond_to?("upcase") && ohm.upcase == "MIGRATE" && "MIGRATE") || "TERMINATE" @@ -166,7 +166,7 @@ module Fog body_object['scheduling'] = scheduling # @see https://developers.google.com/compute/docs/networking#canipforward - if options.has_key? 'can_ip_forward' + if options.key? 'can_ip_forward' body_object['canIpForward'] = options.delete 'can_ip_forward' end diff --git a/lib/fog/hp/models/compute/key_pair.rb b/lib/fog/hp/models/compute/key_pair.rb index 3914f5e5e..872254594 100644 --- a/lib/fog/hp/models/compute/key_pair.rb +++ b/lib/fog/hp/models/compute/key_pair.rb @@ -43,7 +43,7 @@ module Fog end def writable? - !!(private_key && ENV.has_key?('HOME')) + !!(private_key && ENV.key?('HOME')) end end end diff --git a/lib/fog/hp/models/compute_v2/key_pair.rb b/lib/fog/hp/models/compute_v2/key_pair.rb index fef873aec..7b80a14fb 100644 --- a/lib/fog/hp/models/compute_v2/key_pair.rb +++ b/lib/fog/hp/models/compute_v2/key_pair.rb @@ -43,7 +43,7 @@ module Fog end def writable? - !!(private_key && ENV.has_key?('HOME')) + !!(private_key && ENV.key?('HOME')) end end end diff --git a/lib/fog/hp/requests/storage/put_object.rb b/lib/fog/hp/requests/storage/put_object.rb index 30ee31a96..3009981c1 100644 --- a/lib/fog/hp/requests/storage/put_object.rb +++ b/lib/fog/hp/requests/storage/put_object.rb @@ -21,7 +21,7 @@ module Fog :path => "#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}" ) end - if headers.has_key?('Transfer-Encoding') + if headers.key?('Transfer-Encoding') headers.delete('Content-Length') end response = request( diff --git a/lib/fog/hp/requests/storage/put_shared_object.rb b/lib/fog/hp/requests/storage/put_shared_object.rb index 2effe224b..3f85367eb 100644 --- a/lib/fog/hp/requests/storage/put_shared_object.rb +++ b/lib/fog/hp/requests/storage/put_shared_object.rb @@ -27,7 +27,7 @@ module Fog :path => "#{path}/#{Fog::HP.escape(object_name)}" ) end - if headers.has_key?('Transfer-Encoding') + if headers.key?('Transfer-Encoding') headers.delete('Content-Length') end response = shared_request( diff --git a/lib/fog/hp/simple_http_instrumentor.rb b/lib/fog/hp/simple_http_instrumentor.rb index db66e6384..66cbe297c 100644 --- a/lib/fog/hp/simple_http_instrumentor.rb +++ b/lib/fog/hp/simple_http_instrumentor.rb @@ -5,18 +5,18 @@ module Excon def instrument(name, params = {}, &block) params = params.dup - if params.has_key?(:headers) && params[:headers].has_key?('Authorization') + if params.key?(:headers) && params[:headers].key?('Authorization') params[:headers] = params[:headers].dup params[:headers]['Authorization'] = REDACTED end - if params.has_key?(:password) + if params.key?(:password) params[:password] = REDACTED end $stderr.puts("--- #{name} ---") if name.include?('.request') query = '' tmp_query = '' - if params.has_key?(:query) && !params[:query].nil? + if params.key?(:query) && !params[:query].nil? params[:query].each do |key, value| tmp_query += "#{key}=#{value}&" end diff --git a/lib/fog/internet_archive/requests/storage/acl_utils.rb b/lib/fog/internet_archive/requests/storage/acl_utils.rb index fe12f3caf..11dc8cd3c 100644 --- a/lib/fog/internet_archive/requests/storage/acl_utils.rb +++ b/lib/fog/internet_archive/requests/storage/acl_utils.rb @@ -21,11 +21,11 @@ module Fog data << " \n" grantee = grant['Grantee'] type = case - when grantee.has_key?('ID') + when grantee.key?('ID') 'CanonicalUser' - when grantee.has_key?('EmailAddress') + when grantee.key?('EmailAddress') 'AmazonCustomerByEmail' - when grantee.has_key?('URI') + when grantee.key?('URI') 'Group' end diff --git a/lib/fog/internet_archive/requests/storage/get_bucket.rb b/lib/fog/internet_archive/requests/storage/get_bucket.rb index 6b75d4393..7fdb6de66 100644 --- a/lib/fog/internet_archive/requests/storage/get_bucket.rb +++ b/lib/fog/internet_archive/requests/storage/get_bucket.rb @@ -68,7 +68,7 @@ module Fog (marker && object['Key'] <= marker) || (delimiter && object['Key'][(prefix ? prefix.length : 0)..-1].include?(delimiter) \ && common_prefixes << object['Key'].sub(/^(#{prefix}[^#{delimiter}]+.).*/, '\1')) || - object.has_key?(:delete_marker) + object.key?(:delete_marker) end.map do |object| data = object.reject {|key, value| !['ETag', 'Key', 'StorageClass'].include?(key)} data.merge!({ diff --git a/lib/fog/internet_archive/requests/storage/get_object.rb b/lib/fog/internet_archive/requests/storage/get_object.rb index 45ee53d8c..e2decd9dd 100644 --- a/lib/fog/internet_archive/requests/storage/get_object.rb +++ b/lib/fog/internet_archive/requests/storage/get_object.rb @@ -67,7 +67,7 @@ module Fog response = Excon::Response.new if (bucket = self.data[:buckets][bucket_name]) object = nil - if bucket[:objects].has_key?(object_name) + if bucket[:objects].key?(object_name) object = bucket[:objects][object_name].first end diff --git a/lib/fog/libvirt/compute.rb b/lib/fog/libvirt/compute.rb index 2d1a8a03f..bbd7ea30a 100644 --- a/lib/fog/libvirt/compute.rb +++ b/lib/fog/libvirt/compute.rb @@ -124,7 +124,7 @@ module Fog if querystring.nil? append="?socket=/var/run/libvirt/libvirt-sock" else - if !::CGI.parse(querystring).has_key?("socket") + if !::CGI.parse(querystring).key?("socket") append="&socket=/var/run/libvirt/libvirt-sock" end end diff --git a/lib/fog/libvirt/models/compute/util/uri.rb b/lib/fog/libvirt/models/compute/util/uri.rb index 5fc0a5acb..cbb2e8617 100644 --- a/lib/fog/libvirt/models/compute/util/uri.rb +++ b/lib/fog/libvirt/models/compute/util/uri.rb @@ -123,7 +123,7 @@ module Fog def value(name) unless @parsed_uri.query.nil? params=CGI.parse(@parsed_uri.query) - if params.has_key?(name) + if params.key?(name) return params[name].first else return nil diff --git a/lib/fog/libvirt/requests/compute/list_domains.rb b/lib/fog/libvirt/requests/compute/list_domains.rb index 9a37e1dd6..c756b32bf 100644 --- a/lib/fog/libvirt/requests/compute/list_domains.rb +++ b/lib/fog/libvirt/requests/compute/list_domains.rb @@ -5,9 +5,9 @@ module Fog def list_domains(filter = { }) data=[] - if filter.has_key?(:uuid) + if filter.key?(:uuid) data << client.lookup_domain_by_uuid(filter[:uuid]) - elsif filter.has_key?(:name) + elsif filter.key?(:name) data << client.lookup_domain_by_name(filter[:name]) else client.list_defined_domains.each { |name| data << client.lookup_domain_by_name(name) } unless filter[:defined] == false diff --git a/lib/fog/libvirt/requests/compute/list_pools.rb b/lib/fog/libvirt/requests/compute/list_pools.rb index e41e829b7..8113b6afa 100644 --- a/lib/fog/libvirt/requests/compute/list_pools.rb +++ b/lib/fog/libvirt/requests/compute/list_pools.rb @@ -4,9 +4,9 @@ module Fog class Real def list_pools(filter = { }) data=[] - if filter.has_key?(:name) + if filter.key?(:name) data << find_pool_by_name(filter[:name]) - elsif filter.has_key?(:uuid) + elsif filter.key?(:uuid) data << find_pool_by_uuid(filter[:uuid]) else (client.list_storage_pools + client.list_defined_storage_pools).each do |name| diff --git a/lib/fog/libvirt/requests/compute/update_display.rb b/lib/fog/libvirt/requests/compute/update_display.rb index 7d44cd9c7..a2141e1dd 100644 --- a/lib/fog/libvirt/requests/compute/update_display.rb +++ b/lib/fog/libvirt/requests/compute/update_display.rb @@ -3,7 +3,7 @@ module Fog class Libvirt class Real def update_display(options = { }) - raise ArgumentError, "uuid is a required parameter" unless options.has_key? :uuid + raise ArgumentError, "uuid is a required parameter" unless options.key? :uuid display = { } display[:type] = options[:type] || 'vnc' display[:port] = (options[:port] || -1).to_s @@ -22,7 +22,7 @@ module Fog class Mock def update_display(options = { }) - raise ArgumentError, "uuid is a required parameter" unless options.has_key? :uuid + raise ArgumentError, "uuid is a required parameter" unless options.key? :uuid true end end diff --git a/lib/fog/ninefold/compute.rb b/lib/fog/ninefold/compute.rb index f7532845c..946d1f83b 100644 --- a/lib/fog/ninefold/compute.rb +++ b/lib/fog/ninefold/compute.rb @@ -110,7 +110,7 @@ module Fog # the values out with a prefix, and if there is an empty data entry return an # empty version of the expected type (if provided) response = Fog::JSON.decode(response.body) - if options.has_key? :response_prefix + if options.key? :response_prefix keys = options[:response_prefix].split('/') keys.each do |k| if response[k] diff --git a/lib/fog/openstack/models/compute/key_pair.rb b/lib/fog/openstack/models/compute/key_pair.rb index d74bdaaea..9c07785ba 100644 --- a/lib/fog/openstack/models/compute/key_pair.rb +++ b/lib/fog/openstack/models/compute/key_pair.rb @@ -48,7 +48,7 @@ module Fog end def writable? - !!(private_key && ENV.has_key?('HOME')) + !!(private_key && ENV.key?('HOME')) end end end diff --git a/lib/fog/openstack/requests/network/update_lb_health_monitor.rb b/lib/fog/openstack/requests/network/update_lb_health_monitor.rb index 453487965..f4a339fb2 100644 --- a/lib/fog/openstack/requests/network/update_lb_health_monitor.rb +++ b/lib/fog/openstack/requests/network/update_lb_health_monitor.rb @@ -6,7 +6,7 @@ module Fog data = { 'health_monitor' => {} } vanilla_options = [:delay, :timeout, :max_retries, :http_method, :url_path, :expected_codes, :admin_state_up] - vanilla_options.select{ |o| options.has_key?(o) }.each do |key| + vanilla_options.select{ |o| options.key?(o) }.each do |key| data['health_monitor'][key] = options[key] end diff --git a/lib/fog/openstack/requests/network/update_lb_member.rb b/lib/fog/openstack/requests/network/update_lb_member.rb index c22fe479e..ee9ec6947 100644 --- a/lib/fog/openstack/requests/network/update_lb_member.rb +++ b/lib/fog/openstack/requests/network/update_lb_member.rb @@ -6,7 +6,7 @@ module Fog data = { 'member' => {} } vanilla_options = [:pool_id, :weight, :admin_state_up] - vanilla_options.select{ |o| options.has_key?(o) }.each do |key| + vanilla_options.select{ |o| options.key?(o) }.each do |key| data['member'][key] = options[key] end diff --git a/lib/fog/openstack/requests/network/update_lb_pool.rb b/lib/fog/openstack/requests/network/update_lb_pool.rb index 5c32a3142..7e9c9b3aa 100644 --- a/lib/fog/openstack/requests/network/update_lb_pool.rb +++ b/lib/fog/openstack/requests/network/update_lb_pool.rb @@ -6,7 +6,7 @@ module Fog data = { 'pool' => {} } vanilla_options = [:name, :description, :lb_method, :admin_state_up] - vanilla_options.select{ |o| options.has_key?(o) }.each do |key| + vanilla_options.select{ |o| options.key?(o) }.each do |key| data['pool'][key] = options[key] end diff --git a/lib/fog/openstack/requests/network/update_lb_vip.rb b/lib/fog/openstack/requests/network/update_lb_vip.rb index a72dcf344..5828372f5 100644 --- a/lib/fog/openstack/requests/network/update_lb_vip.rb +++ b/lib/fog/openstack/requests/network/update_lb_vip.rb @@ -6,7 +6,7 @@ module Fog data = { 'vip' => {} } vanilla_options = [:pool_id, :name, :description, :session_persistence, :connection_limit, :admin_state_up] - vanilla_options.select{ |o| options.has_key?(o) }.each do |key| + vanilla_options.select{ |o| options.key?(o) }.each do |key| data['vip'][key] = options[key] end diff --git a/lib/fog/openstack/requests/network/update_network.rb b/lib/fog/openstack/requests/network/update_network.rb index 3315587b4..4a955e688 100644 --- a/lib/fog/openstack/requests/network/update_network.rb +++ b/lib/fog/openstack/requests/network/update_network.rb @@ -6,7 +6,7 @@ module Fog data = { 'network' => {} } vanilla_options = [:name, :shared, :admin_state_up] - vanilla_options.select{ |o| options.has_key?(o) }.each do |key| + vanilla_options.select{ |o| options.key?(o) }.each do |key| data['network'][key] = options[key] end diff --git a/lib/fog/openstack/requests/network/update_port.rb b/lib/fog/openstack/requests/network/update_port.rb index 95b268430..130102363 100644 --- a/lib/fog/openstack/requests/network/update_port.rb +++ b/lib/fog/openstack/requests/network/update_port.rb @@ -7,7 +7,7 @@ module Fog vanilla_options = [:name, :fixed_ips, :admin_state_up, :device_owner, :device_id] - vanilla_options.select{ |o| options.has_key?(o) }.each do |key| + vanilla_options.select{ |o| options.key?(o) }.each do |key| data['port'][key] = options[key] end diff --git a/lib/fog/openstack/requests/network/update_subnet.rb b/lib/fog/openstack/requests/network/update_subnet.rb index 999cbb168..34a765188 100644 --- a/lib/fog/openstack/requests/network/update_subnet.rb +++ b/lib/fog/openstack/requests/network/update_subnet.rb @@ -7,7 +7,7 @@ module Fog vanilla_options = [:name, :gateway_ip, :dns_nameservers, :host_routes, :enable_dhcp] - vanilla_options.select{ |o| options.has_key?(o) }.each do |key| + vanilla_options.select{ |o| options.key?(o) }.each do |key| data['subnet'][key] = options[key] end diff --git a/lib/fog/ovirt/requests/compute/destroy_interface.rb b/lib/fog/ovirt/requests/compute/destroy_interface.rb index 9fbd118dd..6e127857c 100644 --- a/lib/fog/ovirt/requests/compute/destroy_interface.rb +++ b/lib/fog/ovirt/requests/compute/destroy_interface.rb @@ -4,7 +4,7 @@ module Fog class Real def destroy_interface(id, options) raise ArgumentError, "instance id is a required parameter" unless id - raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.has_key? :id + raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id client.destroy_interface(id, options[:id]) end @@ -13,7 +13,7 @@ module Fog class Mock def destroy_interface(id, options) raise ArgumentError, "instance id is a required parameter" unless id - raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.has_key? :id + raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id true end end diff --git a/lib/fog/ovirt/requests/compute/destroy_vm.rb b/lib/fog/ovirt/requests/compute/destroy_vm.rb index e8743b7c2..53239924b 100644 --- a/lib/fog/ovirt/requests/compute/destroy_vm.rb +++ b/lib/fog/ovirt/requests/compute/destroy_vm.rb @@ -3,14 +3,14 @@ module Fog class Ovirt class Real def destroy_vm(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id + raise ArgumentError, "instance id is a required parameter" unless options.key? :id client.destroy_vm(options[:id]) end end class Mock def destroy_vm(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id + raise ArgumentError, "instance id is a required parameter" unless options.key? :id true end end diff --git a/lib/fog/ovirt/requests/compute/destroy_volume.rb b/lib/fog/ovirt/requests/compute/destroy_volume.rb index 3a812a520..e19cfd816 100644 --- a/lib/fog/ovirt/requests/compute/destroy_volume.rb +++ b/lib/fog/ovirt/requests/compute/destroy_volume.rb @@ -4,7 +4,7 @@ module Fog class Real def destroy_volume(id, options) raise ArgumentError, "instance id is a required parameter" unless id - raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.has_key? :id + raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.key? :id client.destroy_volume(id, options[:id]) end @@ -13,7 +13,7 @@ module Fog class Mock def destroy_volume(id, options) raise ArgumentError, "instance id is a required parameter" unless id - raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.has_key? :id + raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.key? :id true end end diff --git a/lib/fog/ovirt/requests/compute/update_interface.rb b/lib/fog/ovirt/requests/compute/update_interface.rb index 0477cee02..9d3236e15 100644 --- a/lib/fog/ovirt/requests/compute/update_interface.rb +++ b/lib/fog/ovirt/requests/compute/update_interface.rb @@ -4,7 +4,7 @@ module Fog class Real def update_interface(id, options) raise ArgumentError, "instance id is a required parameter" unless id - raise ArgumentError, "interface id is a required parameter for update-interface" unless options.has_key? :id + raise ArgumentError, "interface id is a required parameter for update-interface" unless options.key? :id client.update_interface(id, options) end @@ -13,7 +13,7 @@ module Fog class Mock def update_interface(id, options) raise ArgumentError, "instance id is a required parameter" unless id - raise ArgumentError, "interface id is a required parameter for update-interface" unless options.has_key? :id + raise ArgumentError, "interface id is a required parameter for update-interface" unless options.key? :id true end end diff --git a/lib/fog/ovirt/requests/compute/vm_action.rb b/lib/fog/ovirt/requests/compute/vm_action.rb index f2390c95f..afa9bb455 100644 --- a/lib/fog/ovirt/requests/compute/vm_action.rb +++ b/lib/fog/ovirt/requests/compute/vm_action.rb @@ -3,8 +3,8 @@ module Fog class Ovirt class Real def vm_action(options = {}) - raise ArgumentError, "instance id is a required parameter" unless options.has_key? :id - raise ArgumentError, "action is a required parameter" unless options.has_key? :action + raise ArgumentError, "instance id is a required parameter" unless options.key? :id + raise ArgumentError, "action is a required parameter" unless options.key? :action client.vm_action options[:id], options[:action] end @@ -12,8 +12,8 @@ module Fog class Mock def vm_action(options = {}) - raise ArgumentError, "id is a required parameter" unless options.has_key? :id - raise ArgumentError, "action is a required parameter" unless options.has_key? :action + raise ArgumentError, "id is a required parameter" unless options.key? :id + raise ArgumentError, "action is a required parameter" unless options.key? :action true end end diff --git a/lib/fog/rackspace/block_storage.rb b/lib/fog/rackspace/block_storage.rb index 1018ec04e..57ace4fc5 100644 --- a/lib/fog/rackspace/block_storage.rb +++ b/lib/fog/rackspace/block_storage.rb @@ -61,7 +61,7 @@ module Fog headers = params[:headers] || {} response = Excon::Response.new(:body => body, :headers => headers, :status => status) - if params.has_key?(:expects) && ![*params[:expects]].include?(response.status) + if params.key?(:expects) && ![*params[:expects]].include?(response.status) raise(Excon::Errors.status_error(params, response)) else response end diff --git a/lib/fog/rackspace/compute_v2.rb b/lib/fog/rackspace/compute_v2.rb index 3578d8586..f60623682 100644 --- a/lib/fog/rackspace/compute_v2.rb +++ b/lib/fog/rackspace/compute_v2.rb @@ -135,7 +135,7 @@ module Fog headers = params[:headers] || {} response = Excon::Response.new(:body => body, :headers => headers, :status => status) - if params.has_key?(:expects) && ![*params[:expects]].include?(response.status) + if params.key?(:expects) && ![*params[:expects]].include?(response.status) raise(Excon::Errors.status_error(params, response)) else response end diff --git a/lib/fog/rackspace/requests/compute_v2/delete_network.rb b/lib/fog/rackspace/requests/compute_v2/delete_network.rb index 694931d33..e8dc63a38 100644 --- a/lib/fog/rackspace/requests/compute_v2/delete_network.rb +++ b/lib/fog/rackspace/requests/compute_v2/delete_network.rb @@ -9,7 +9,7 @@ module Fog class Mock def delete_network(id) - unless self.data[:networks].has_key?(id) + unless self.data[:networks].key?(id) raise Fog::Compute::RackspaceV2::NotFound end diff --git a/lib/fog/rackspace/requests/compute_v2/get_network.rb b/lib/fog/rackspace/requests/compute_v2/get_network.rb index 424701564..acc0ff905 100644 --- a/lib/fog/rackspace/requests/compute_v2/get_network.rb +++ b/lib/fog/rackspace/requests/compute_v2/get_network.rb @@ -9,7 +9,7 @@ module Fog class Mock def get_network(id) - unless self.data[:networks].has_key?(id) + unless self.data[:networks].key?(id) raise Fog::Compute::RackspaceV2::NotFound end diff --git a/lib/fog/rackspace/requests/dns/add_records.rb b/lib/fog/rackspace/requests/dns/add_records.rb index 47a38661f..ca1ffb957 100644 --- a/lib/fog/rackspace/requests/dns/add_records.rb +++ b/lib/fog/rackspace/requests/dns/add_records.rb @@ -13,11 +13,11 @@ module Fog 'data' => record[:data] } - if record.has_key? :ttl + if record.key? :ttl record_data['ttl'] = record[:ttl] end - if record.has_key? :priority + if record.key? :priority record_data['priority'] = record[:priority] end record_data diff --git a/lib/fog/rackspace/requests/dns/create_domains.rb b/lib/fog/rackspace/requests/dns/create_domains.rb index b9c86ceba..8697be443 100644 --- a/lib/fog/rackspace/requests/dns/create_domains.rb +++ b/lib/fog/rackspace/requests/dns/create_domains.rb @@ -14,7 +14,7 @@ module Fog 'emailAddress' => domain[:email] } - if domain.has_key? :records + if domain.key? :records domain_data['recordsList'] = { 'records' => domain[:records].map do |record| record_data = { @@ -24,7 +24,7 @@ module Fog 'type' => record[:type], } - if record.has_key? :priority + if record.key? :priority record_data.merge!({'priority' => record[:priority]}) else record_data diff --git a/lib/fog/rackspace/requests/dns/list_domain_details.rb b/lib/fog/rackspace/requests/dns/list_domain_details.rb index 4aa72c6e3..a2162956c 100644 --- a/lib/fog/rackspace/requests/dns/list_domain_details.rb +++ b/lib/fog/rackspace/requests/dns/list_domain_details.rb @@ -8,10 +8,10 @@ module Fog path = "domains/#{domain_id}" query_data = {} - if options.has_key? :show_records + if options.key? :show_records query_data['showRecords'] = options[:show_records] end - if options.has_key? :show_subdomains + if options.key? :show_subdomains query_data['showSubdomains'] = options[:show_subdomains] end diff --git a/lib/fog/rackspace/requests/dns/modify_domain.rb b/lib/fog/rackspace/requests/dns/modify_domain.rb index 152283df4..ea3cdd81a 100644 --- a/lib/fog/rackspace/requests/dns/modify_domain.rb +++ b/lib/fog/rackspace/requests/dns/modify_domain.rb @@ -8,13 +8,13 @@ module Fog path = "domains/#{domain_id}" data = {} - if options.has_key? :ttl + if options.key? :ttl data['ttl'] = options[:ttl] end - if options.has_key? :comment + if options.key? :comment data['comment'] = options[:comment] end - if options.has_key? :email + if options.key? :email data['emailAddress'] = options[:email] end diff --git a/lib/fog/rackspace/requests/dns/modify_record.rb b/lib/fog/rackspace/requests/dns/modify_record.rb index 67b1a0414..e66b9483e 100644 --- a/lib/fog/rackspace/requests/dns/modify_record.rb +++ b/lib/fog/rackspace/requests/dns/modify_record.rb @@ -9,13 +9,13 @@ module Fog path = "domains/#{domain_id}/records/#{record_id}" data = {} - if options.has_key? :ttl + if options.key? :ttl data['ttl'] = options[:ttl] end - if options.has_key? :name + if options.key? :name data['name'] = options[:name] end - if options.has_key? :data + if options.key? :data data['data'] = options[:data] end diff --git a/lib/fog/rackspace/requests/dns/remove_domain.rb b/lib/fog/rackspace/requests/dns/remove_domain.rb index d07898738..9039abfd9 100644 --- a/lib/fog/rackspace/requests/dns/remove_domain.rb +++ b/lib/fog/rackspace/requests/dns/remove_domain.rb @@ -8,7 +8,7 @@ module Fog path = "domains/#{domain_id}" query_data = {} - if options.has_key? :delete_subdomains + if options.key? :delete_subdomains query_data['deleteSubdomains'] = options[:delete_subdomains].to_s end diff --git a/lib/fog/rackspace/requests/dns/remove_domains.rb b/lib/fog/rackspace/requests/dns/remove_domains.rb index 4d138e4a5..bc2c1aecd 100644 --- a/lib/fog/rackspace/requests/dns/remove_domains.rb +++ b/lib/fog/rackspace/requests/dns/remove_domains.rb @@ -6,7 +6,7 @@ module Fog path = "domains?" + domain_ids.map { |domain_id| "id=#{domain_id}" }.join('&') query_data = {} - if options.has_key? :delete_subdomains + if options.key? :delete_subdomains query_data['deleteSubdomains'] = options[:delete_subdomains] end diff --git a/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb b/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb index ee86cc826..92f2f5517 100644 --- a/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb +++ b/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb @@ -13,8 +13,8 @@ module Fog } data['loadBalancer']['nodes'] = nodes if nodes && !nodes.empty? - data['loadBalancer']['algorithm'] = options[:algorithm] if options.has_key? :algorithm - data['loadBalancer']['timeout'] = options[:timeout] if options.has_key? :timeout + data['loadBalancer']['algorithm'] = options[:algorithm] if options.key? :algorithm + data['loadBalancer']['timeout'] = options[:timeout] if options.key? :timeout request( :body => Fog::JSON.encode(data), diff --git a/lib/fog/rackspace/requests/load_balancers/create_node.rb b/lib/fog/rackspace/requests/load_balancers/create_node.rb index b0a3956f1..5e12ce7df 100644 --- a/lib/fog/rackspace/requests/load_balancers/create_node.rb +++ b/lib/fog/rackspace/requests/load_balancers/create_node.rb @@ -11,7 +11,7 @@ module Fog 'condition' => condition } ]} - if options.has_key?(:weight) + if options.key?(:weight) data['nodes'][0]['weight'] = options[:weight] end request( diff --git a/lib/fog/rackspace/requests/load_balancers/get_load_balancer_usage.rb b/lib/fog/rackspace/requests/load_balancers/get_load_balancer_usage.rb index dc65c1ddf..7283c69af 100644 --- a/lib/fog/rackspace/requests/load_balancers/get_load_balancer_usage.rb +++ b/lib/fog/rackspace/requests/load_balancers/get_load_balancer_usage.rb @@ -4,7 +4,7 @@ module Fog class Real def get_load_balancer_usage(load_balancer_id, options = {}) #TODO - Didn't implement usage/current. Not sure if it is needed - if options.has_key? :start_time and options.has_key? :end_time + if options.key? :start_time and options.key? :end_time query = "?startTime=#{options[:start_time]}&endTime=#{options[:end_time]}" else query = '' diff --git a/lib/fog/rackspace/requests/load_balancers/get_usage.rb b/lib/fog/rackspace/requests/load_balancers/get_usage.rb index 1c2a117ec..d5b6228cf 100644 --- a/lib/fog/rackspace/requests/load_balancers/get_usage.rb +++ b/lib/fog/rackspace/requests/load_balancers/get_usage.rb @@ -3,7 +3,7 @@ module Fog class LoadBalancers class Real def get_usage(options = {}) - if options.has_key? :start_time and options.has_key? :end_time + if options.key? :start_time and options.key? :end_time query = "?startTime=#{options[:start_time]}&endTime=#{options[:end_time]}" else query = '' diff --git a/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb b/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb index ac1b7f2d2..542508012 100644 --- a/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +++ b/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb @@ -3,7 +3,7 @@ module Fog class LoadBalancers class Real def list_load_balancers(options = {}) - if options.has_key? :node_address + if options.key? :node_address query_string = "?nodeaddress=#{options[:node_address]}" else query_string = '' diff --git a/lib/fog/rackspace/requests/load_balancers/set_monitor.rb b/lib/fog/rackspace/requests/load_balancers/set_monitor.rb index a216916b8..3d0f15a6b 100644 --- a/lib/fog/rackspace/requests/load_balancers/set_monitor.rb +++ b/lib/fog/rackspace/requests/load_balancers/set_monitor.rb @@ -9,13 +9,13 @@ module Fog 'timeout' => timeout, 'attemptsBeforeDeactivation' => attempsBeforeDeactivation } - if options.has_key? :path + if options.key? :path data['path'] = options[:path] end - if options.has_key? :body_regex + if options.key? :body_regex data['bodyRegex'] = options[:body_regex] end - if options.has_key? :status_regex + if options.key? :status_regex data['statusRegex'] = options[:status_regex] end request( diff --git a/lib/fog/rackspace/requests/load_balancers/set_ssl_termination.rb b/lib/fog/rackspace/requests/load_balancers/set_ssl_termination.rb index 4bb493a10..8d96c15a7 100644 --- a/lib/fog/rackspace/requests/load_balancers/set_ssl_termination.rb +++ b/lib/fog/rackspace/requests/load_balancers/set_ssl_termination.rb @@ -9,13 +9,13 @@ module Fog :certificate => certificate } - if options.has_key? :intermediate_certificate + if options.key? :intermediate_certificate data['intermediateCertificate'] = options[:intermediate_certificate] end - if options.has_key? :enabled + if options.key? :enabled data['enabled'] = options[:enabled] end - if options.has_key? :secure_traffic_only + if options.key? :secure_traffic_only data['secureTrafficOnly'] = options[:secure_traffic_only] end request( diff --git a/lib/fog/rackspace/requests/load_balancers/update_node.rb b/lib/fog/rackspace/requests/load_balancers/update_node.rb index 645709861..6bb34aa95 100644 --- a/lib/fog/rackspace/requests/load_balancers/update_node.rb +++ b/lib/fog/rackspace/requests/load_balancers/update_node.rb @@ -6,10 +6,10 @@ module Fog data = { 'node' => {} } - if options.has_key? :weight + if options.key? :weight data['node']['weight'] = options[:weight] end - if options.has_key? :condition + if options.key? :condition data['node']['condition'] = options[:condition] end #TODO - Do anything if no valid options are passed in? diff --git a/lib/fog/rackspace/requests/queues/create_claim.rb b/lib/fog/rackspace/requests/queues/create_claim.rb index 382a57857..483db2d52 100644 --- a/lib/fog/rackspace/requests/queues/create_claim.rb +++ b/lib/fog/rackspace/requests/queues/create_claim.rb @@ -23,7 +23,7 @@ module Fog } query = {} - query[:limit] = options[:limit] if options.has_key? :limit + query[:limit] = options[:limit] if options.key? :limit request( :body => Fog::JSON.encode(body), :expects => [200, 201, 204], diff --git a/lib/fog/rackspace/requests/queues/delete_message.rb b/lib/fog/rackspace/requests/queues/delete_message.rb index faccda984..63d22c988 100644 --- a/lib/fog/rackspace/requests/queues/delete_message.rb +++ b/lib/fog/rackspace/requests/queues/delete_message.rb @@ -17,7 +17,7 @@ module Fog # @see http://docs.rackspace.com/queues/api/v1.0/cq-devguide/content/DELETE_deleteMessage__version__queues__queue_name__messages__messageId__message-operations-dle001.html def delete_message(queue_name, message_id, options = {}) query = {} - query[:claim_id] = options[:claim_id] if options.has_key? :claim_id + query[:claim_id] = options[:claim_id] if options.key? :claim_id request( :expects => 204, :method => 'DELETE', diff --git a/lib/fog/storm_on_demand/shared.rb b/lib/fog/storm_on_demand/shared.rb index 0367d7de4..3bf2f9d33 100644 --- a/lib/fog/storm_on_demand/shared.rb +++ b/lib/fog/storm_on_demand/shared.rb @@ -43,7 +43,7 @@ module Fog unless response.body.empty? response.body = Fog::JSON.decode(response.body) end - if response.body.has_key?('error_class') + if response.body.key?('error_class') raise(Fog::Compute::StormOnDemand::Error, response.body.inspect) end response diff --git a/lib/fog/terremark/parsers/shared/network.rb b/lib/fog/terremark/parsers/shared/network.rb index 4b2c5fbe4..8cf07d915 100644 --- a/lib/fog/terremark/parsers/shared/network.rb +++ b/lib/fog/terremark/parsers/shared/network.rb @@ -14,10 +14,10 @@ module Fog case name when "Network" @response = extract_attributes(attributes) - if @response.has_key?("name") + if @response.key?("name") @response["subnet"] = @response["name"] end - if @response.has_key?("href") + if @response.key?("href") @response["id"] = @response["href"].split("/").last end when "Link" diff --git a/lib/fog/terremark/requests/shared/add_internet_service.rb b/lib/fog/terremark/requests/shared/add_internet_service.rb index 2a4f9e434..73eb4e6e0 100644 --- a/lib/fog/terremark/requests/shared/add_internet_service.rb +++ b/lib/fog/terremark/requests/shared/add_internet_service.rb @@ -26,7 +26,7 @@ module Fog # * 'name'<~String> - name of owner # * 'type'<~String> - type of owner def add_internet_service(ip_id, name, protocol, port, options = {}) - unless options.has_key?('Enabled') + unless options.key?('Enabled') options['Enabled'] = true end data = <<-DATA diff --git a/lib/fog/terremark/requests/shared/add_node_service.rb b/lib/fog/terremark/requests/shared/add_node_service.rb index 17b79572e..5f63907be 100644 --- a/lib/fog/terremark/requests/shared/add_node_service.rb +++ b/lib/fog/terremark/requests/shared/add_node_service.rb @@ -26,7 +26,7 @@ module Fog # * 'name'<~String> - name of owner # * 'type'<~String> - type of owner def add_node_service(service_id, ip, name, port, options = {}) - unless options.has_key?('Enabled') + unless options.key?('Enabled') options['Enabled'] = true end diff --git a/lib/fog/terremark/requests/shared/create_internet_service.rb b/lib/fog/terremark/requests/shared/create_internet_service.rb index c7fe3ff0c..107ab3d09 100644 --- a/lib/fog/terremark/requests/shared/create_internet_service.rb +++ b/lib/fog/terremark/requests/shared/create_internet_service.rb @@ -28,7 +28,7 @@ module Fog # * 'name'<~String> - name of owner # * 'type'<~String> - type of owner def create_internet_service(vdc_id, name, protocol, port, options = {}) - unless options.has_key?('Enabled') + unless options.key?('Enabled') options['Enabled'] = true end #Sample: "https://services.vcloudexpress.terremark.com/api/extensions/v1.6/vdc/3142/internetServices" diff --git a/lib/fog/vcloud/requests/compute/clone_vapp.rb b/lib/fog/vcloud/requests/compute/clone_vapp.rb index 719502ad1..5cde07a18 100644 --- a/lib/fog/vcloud/requests/compute/clone_vapp.rb +++ b/lib/fog/vcloud/requests/compute/clone_vapp.rb @@ -4,7 +4,7 @@ module Fog class Real def validate_clone_vapp_options(options) valid_opts = [:name, :poweron] - unless valid_opts.all? { |opt| options.has_key?(opt) } + unless valid_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}") end end @@ -18,7 +18,7 @@ module Fog end def clone_vapp(vdc_uri, vapp_uri, options = {}) - unless options.has_key?(:poweron) + unless options.key?(:poweron) options[:poweron] = "false" end diff --git a/lib/fog/vcloud/requests/compute/configure_metadata.rb b/lib/fog/vcloud/requests/compute/configure_metadata.rb index 1347d010c..dc9e0815d 100644 --- a/lib/fog/vcloud/requests/compute/configure_metadata.rb +++ b/lib/fog/vcloud/requests/compute/configure_metadata.rb @@ -4,7 +4,7 @@ module Fog class Real def configure_metadata(opts= {}) valid_opts = [:key, :value, :href] - unless valid_opts.all? { |opt| opts.has_key?(opt) } + unless valid_opts.all? { |opt| opts.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - opts.keys).map(&:inspect).join(", ")}") end diff --git a/lib/fog/vcloud/requests/compute/configure_network.rb b/lib/fog/vcloud/requests/compute/configure_network.rb index 21d18b944..f7bee9ea8 100644 --- a/lib/fog/vcloud/requests/compute/configure_network.rb +++ b/lib/fog/vcloud/requests/compute/configure_network.rb @@ -4,7 +4,7 @@ module Fog class Real def validate_network_data(network_data, configure=false) valid_opts = [:id, :href, :name, :address, :broadcast, :gateway] - unless valid_opts.all? { |opt| network_data.has_key?(opt) } + unless valid_opts.all? { |opt| network_data.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - network_data.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/vcloud/requests/compute/configure_network_ip.rb b/lib/fog/vcloud/requests/compute/configure_network_ip.rb index 121d4fb34..6a0087452 100644 --- a/lib/fog/vcloud/requests/compute/configure_network_ip.rb +++ b/lib/fog/vcloud/requests/compute/configure_network_ip.rb @@ -6,7 +6,7 @@ module Fog def validate_network_ip_data(network_ip_data) valid_opts = [:id, :href, :name, :status, :server] - unless valid_opts.all? { |opt| network_ip_data.has_key?(opt) } + unless valid_opts.all? { |opt| network_ip_data.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - network_ip_data.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/vcloud/requests/compute/configure_vapp.rb b/lib/fog/vcloud/requests/compute/configure_vapp.rb index 3dfe7703a..0f754c1c9 100644 --- a/lib/fog/vcloud/requests/compute/configure_vapp.rb +++ b/lib/fog/vcloud/requests/compute/configure_vapp.rb @@ -6,7 +6,7 @@ module Fog def validate_vapp_data(vapp_data) valid_opts = [:name, :cpus, :memory, :disks] - unless valid_opts.all? { |opt| vapp_data.has_key?(opt) } + unless valid_opts.all? { |opt| vapp_data.key?(opt) } raise ArgumentError.new("Required Vapp data missing: #{(valid_opts - vapp_data.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/vcloud/requests/compute/configure_vm.rb b/lib/fog/vcloud/requests/compute/configure_vm.rb index bb19e0fed..db2d0b708 100644 --- a/lib/fog/vcloud/requests/compute/configure_vm.rb +++ b/lib/fog/vcloud/requests/compute/configure_vm.rb @@ -6,7 +6,7 @@ module Fog def validate_vm_data(vm_data) valid_opts = [:name, :cpus, :memory, :disks] - unless valid_opts.all? { |opt| vm_data.has_key?(opt) } + unless valid_opts.all? { |opt| vm_data.key?(opt) } raise ArgumentError.new("Required vm data missing: #{(valid_opts - vm_data.keys).map(&:inspect).join(", ")}") end end diff --git a/lib/fog/vcloud/requests/compute/instantiate_vapp_template.rb b/lib/fog/vcloud/requests/compute/instantiate_vapp_template.rb index 8a9c39795..b2a71e0d6 100644 --- a/lib/fog/vcloud/requests/compute/instantiate_vapp_template.rb +++ b/lib/fog/vcloud/requests/compute/instantiate_vapp_template.rb @@ -7,7 +7,7 @@ module Fog def validate_instantiate_vapp_template_options options # :network_uri removed, if not specified will use template network config. valid_opts = [:catalog_item_uri, :name, :vdc_uri] - unless valid_opts.all? { |opt| options.has_key?(opt) } + unless valid_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}") end diff --git a/lib/fog/vmfusion/models/compute/servers.rb b/lib/fog/vmfusion/models/compute/servers.rb index fcd29fc89..d0b0a663a 100644 --- a/lib/fog/vmfusion/models/compute/servers.rb +++ b/lib/fog/vmfusion/models/compute/servers.rb @@ -13,7 +13,7 @@ module Fog states = ::Fission::VM.all_with_status.data filter = {} if filter.nil? - unless filter.has_key?(:name) + unless filter.key?(:name) vms=::Fission::VM.all.data vms.each do |vm| data << { :raw => { :fission => vm, diff --git a/lib/fog/voxel/requests/compute/voxcloud_create.rb b/lib/fog/voxel/requests/compute/voxcloud_create.rb index fe7cb810f..aa898d212 100644 --- a/lib/fog/voxel/requests/compute/voxcloud_create.rb +++ b/lib/fog/voxel/requests/compute/voxcloud_create.rb @@ -7,7 +7,7 @@ module Fog def voxcloud_create(options) options[:parser] = Fog::Parsers::Compute::Voxel::VoxcloudCreate.new - if options.has_key?(:password) + if options.key?(:password) options[:admin_password] = options[:password] options.delete(:password) end diff --git a/lib/fog/vsphere/models/compute/interface.rb b/lib/fog/vsphere/models/compute/interface.rb index 4e0b2cd2c..198501a5b 100644 --- a/lib/fog/vsphere/models/compute/interface.rb +++ b/lib/fog/vsphere/models/compute/interface.rb @@ -20,7 +20,7 @@ module Fog # Assign server first to prevent race condition with persisted? self.server_id = attributes.delete(:server_id) - if attributes.has_key? :type then + if attributes.key? :type then if attributes[:type].is_a? String then attributes[:type] = Fog::Vsphere.class_from_string(attributes[:type], "RbVmomi::VIM") end diff --git a/lib/fog/vsphere/models/compute/volumes.rb b/lib/fog/vsphere/models/compute/volumes.rb index 1c4d0599e..4941ee955 100644 --- a/lib/fog/vsphere/models/compute/volumes.rb +++ b/lib/fog/vsphere/models/compute/volumes.rb @@ -32,7 +32,7 @@ module Fog def new(attributes = {}) if server # Default to the root volume datastore if one is not configured. - datastore = ! attributes.has_key?(:datastore) && self.any? ? self.first.datastore : nil + datastore = ! attributes.key?(:datastore) && self.any? ? self.first.datastore : nil super({ :server_id => server.id, :datastore => datastore }.merge!(attributes)) else diff --git a/lib/fog/vsphere/requests/compute/create_vm.rb b/lib/fog/vsphere/requests/compute/create_vm.rb index 267c518fc..998f7da2e 100644 --- a/lib/fog/vsphere/requests/compute/create_vm.rb +++ b/lib/fog/vsphere/requests/compute/create_vm.rb @@ -106,7 +106,7 @@ module Fog end def controller_get_shared_from_options options - if (options.has_key? :shared and options[:shared]==false) or not options.has_key? :shared then + if (options.key? :shared and options[:shared]==false) or not options.key? :shared then :noSharing elsif options[:shared]==true then :virtualSharing diff --git a/lib/fog/vsphere/requests/compute/list_interface_types.rb b/lib/fog/vsphere/requests/compute/list_interface_types.rb index 1afb232b9..561fc2fbd 100644 --- a/lib/fog/vsphere/requests/compute/list_interface_types.rb +++ b/lib/fog/vsphere/requests/compute/list_interface_types.rb @@ -6,7 +6,7 @@ module Fog datacenter_name = filters[:datacenter] servertype_name = filters[:servertype] get_raw_server_type(servertype_name, datacenter_name)[:supportedEthernetCard].map do | nictype | - next if filters.has_key?(:id) and filters[:id] != nictype + next if filters.key?(:id) and filters[:id] != nictype interface_type_attributes(nictype, servertype_name, datacenter_name) end.compact end diff --git a/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb b/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb index c57747170..420b51a0b 100644 --- a/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +++ b/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb @@ -47,9 +47,9 @@ module Fog if options.is_a? Fog::Compute::Vsphere::Interface options else - raise ArgumentError, "Either key or name is a required parameter. options: #{options}" unless options.has_key? :key or options.has_key? :mac or options.has_key? :name + raise ArgumentError, "Either key or name is a required parameter. options: #{options}" unless options.key? :key or options.key? :mac or options.key? :name list_vm_interfaces(vm_id).find do | nic | - (options.has_key? :key and nic[:key]==options[:key].to_i) or (options.has_key? :mac and nic[:mac]==options[:mac]) or (options.has_key? :name and nic[:name]==options[:name]) + (options.key? :key and nic[:key]==options[:key].to_i) or (options.key? :mac and nic[:mac]==options[:mac]) or (options.key? :name and nic[:name]==options[:name]) end end end diff --git a/lib/fog/vsphere/requests/compute/vm_clone.rb b/lib/fog/vsphere/requests/compute/vm_clone.rb index bb9f1ce0c..a655d4e4f 100644 --- a/lib/fog/vsphere/requests/compute/vm_clone.rb +++ b/lib/fog/vsphere/requests/compute/vm_clone.rb @@ -14,7 +14,7 @@ module Fog options["path"] ||= options["template_path"] required_options = %w{ datacenter template_path name } required_options.each do |param| - raise ArgumentError, "#{required_options.join(', ')} are required" unless options.has_key? param + raise ArgumentError, "#{required_options.join(', ')} are required" unless options.key? param end raise Fog::Compute::Vsphere::NotFound, "Datacenter #{options["datacenter"]} Doesn't Exist!" unless get_datacenter(options["datacenter"]) raise Fog::Compute::Vsphere::NotFound, "Template #{options["template_path"]} Doesn't Exist!" unless get_virtual_machine(options["template_path"], options["datacenter"]) @@ -85,12 +85,12 @@ module Fog # Options['dest_folder']<~String> # Grab the destination folder object if it exists else use cloned mach - dest_folder = get_raw_vmfolder(options['dest_folder'], options['datacenter']) if options.has_key?('dest_folder') + dest_folder = get_raw_vmfolder(options['dest_folder'], options['datacenter']) if options.key?('dest_folder') dest_folder ||= vm_mob_ref.parent # Options['resource_pool']<~Array> # Now find _a_ resource pool to use for the clone if one is not specified - if ( options.has_key?('resource_pool') && options['resource_pool'].is_a?(Array) && options['resource_pool'].length == 2 ) + if ( options.key?('resource_pool') && options['resource_pool'].is_a?(Array) && options['resource_pool'].length == 2 ) cluster_name = options['resource_pool'][0] pool_name = options['resource_pool'][1] resource_pool = get_raw_resource_pool(pool_name, cluster_name, options['datacenter']) @@ -110,14 +110,14 @@ module Fog # Options['datastore']<~String> # Grab the datastore object if option is set - datastore_obj = get_raw_datastore(options['datastore'], options['datacenter']) if options.has_key?('datastore') + datastore_obj = get_raw_datastore(options['datastore'], options['datacenter']) if options.key?('datastore') # confirm nil if nil or option is not set datastore_obj ||= nil virtual_machine_config_spec = RbVmomi::VIM::VirtualMachineConfigSpec() # Options['network'] # Build up the config spec - if ( options.has_key?('network_label') ) + if ( options.key?('network_label') ) #network_obj = datacenter_obj.networkFolder.find(options['network_label']) config_spec_operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('edit') nic_backing_info = RbVmomi::VIM::VirtualEthernetCardNetworkBackingInfo(:deviceName => options['network_label']) @@ -142,8 +142,8 @@ module Fog # https://github.com/rlane/rbvmomi/blob/master/test/test_serialization.rb # http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.ConfigSpec.html # FIXME: pad this out with the rest of the useful things in VirtualMachineConfigSpec - virtual_machine_config_spec.numCPUs = options['numCPUs'] if ( options.has_key?('numCPUs') ) - virtual_machine_config_spec.memoryMB = options['memoryMB'] if ( options.has_key?('memoryMB') ) + virtual_machine_config_spec.numCPUs = options['numCPUs'] if ( options.key?('numCPUs') ) + virtual_machine_config_spec.memoryMB = options['memoryMB'] if ( options.key?('memoryMB') ) # Options['customization_spec'] # Build up all the crappy tiered objects like the perl method # Collect your variables ifset (writing at 11pm revist me) @@ -154,22 +154,22 @@ module Fog # * gateway <~Array> - Optional - Sets the gateway for the interface - Example: ["10.0.0.1"] # * subnetMask <~String> - *REQUIRED* - Set the netmask of the interface - Example: "255.255.255.0" # For other ip settings options see http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.customization.IPSettings.html - if ( options.has_key?('customization_spec') ) + if ( options.key?('customization_spec') ) cust_options = options['customization_spec'] - if cust_options.has_key?("ipsettings") - raise ArgumentError, "ip and subnetMask is required for static ip" unless cust_options["ipsettings"].has_key?("ip") and - cust_options["ipsettings"].has_key?("subnetMask") + if cust_options.key?("ipsettings") + raise ArgumentError, "ip and subnetMask is required for static ip" unless cust_options["ipsettings"].key?("ip") and + cust_options["ipsettings"].key?("subnetMask") end - raise ArgumentError, "domain is required" unless cust_options.has_key?("domain") + raise ArgumentError, "domain is required" unless cust_options.key?("domain") cust_domain = cust_options['domain'] - cust_ip_settings = RbVmomi::VIM::CustomizationIPSettings.new(cust_options["ipsettings"]) if cust_options.has_key?("ipsettings") - cust_ip_settings.ip = RbVmomi::VIM::CustomizationFixedIp("ipAddress" => cust_options["ipsettings"]["ip"]) if cust_options.has_key?("ipsettings") + cust_ip_settings = RbVmomi::VIM::CustomizationIPSettings.new(cust_options["ipsettings"]) if cust_options.key?("ipsettings") + cust_ip_settings.ip = RbVmomi::VIM::CustomizationFixedIp("ipAddress" => cust_options["ipsettings"]["ip"]) if cust_options.key?("ipsettings") cust_ip_settings ||= RbVmomi::VIM::CustomizationIPSettings.new("ip" => RbVmomi::VIM::CustomizationDhcpIpGenerator.new()) cust_ip_settings.dnsDomain = cust_domain cust_global_ip_settings = RbVmomi::VIM::CustomizationGlobalIPSettings.new cust_global_ip_settings.dnsServerList = cust_ip_settings.dnsServerList cust_global_ip_settings.dnsSuffixList = [cust_domain] - cust_hostname = RbVmomi::VIM::CustomizationFixedName.new(:name => cust_options['hostname']) if cust_options.has_key?('hostname') + cust_hostname = RbVmomi::VIM::CustomizationFixedName.new(:name => cust_options['hostname']) if cust_options.key?('hostname') cust_hostname ||= RbVmomi::VIM::CustomizationFixedName.new(:name => options['name']) cust_hwclockutc = cust_options['hw_clock_utc'] cust_timezone = cust_options['time_zone'] @@ -232,7 +232,7 @@ module Fog clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(:location => relocation_spec, :config => virtual_machine_config_spec, :customization => customization_spec, - :powerOn => options.has_key?('power_on') ? options['power_on'] : true, + :powerOn => options.key?('power_on') ? options['power_on'] : true, :template => false) # Perform the actual Clone Task diff --git a/lib/fog/vsphere/requests/compute/vm_config_vnc.rb b/lib/fog/vsphere/requests/compute/vm_config_vnc.rb index f3369ecfa..ddfa0eab7 100644 --- a/lib/fog/vsphere/requests/compute/vm_config_vnc.rb +++ b/lib/fog/vsphere/requests/compute/vm_config_vnc.rb @@ -3,7 +3,7 @@ module Fog class Vsphere class Real def vm_config_vnc(options = { }) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true } vm_mob_ref = @connection.searchIndex.FindAllByUuid(search_filter).first @@ -32,7 +32,7 @@ module Fog class Mock def vm_config_vnc(options = { }) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' { 'task_state' => 'success' } end diff --git a/lib/fog/vsphere/requests/compute/vm_destroy.rb b/lib/fog/vsphere/requests/compute/vm_destroy.rb index 7ff1204fc..200889e04 100644 --- a/lib/fog/vsphere/requests/compute/vm_destroy.rb +++ b/lib/fog/vsphere/requests/compute/vm_destroy.rb @@ -3,7 +3,7 @@ module Fog class Vsphere class Real def vm_destroy(options = {}) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' vm_mob_ref = get_vm_ref(options['instance_uuid']) task = vm_mob_ref.Destroy_Task @@ -14,7 +14,7 @@ module Fog class Mock def vm_destroy(options = {}) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' { 'task_state' => 'success' } end end diff --git a/lib/fog/vsphere/requests/compute/vm_migrate.rb b/lib/fog/vsphere/requests/compute/vm_migrate.rb index a07c7f49d..c4a422a53 100644 --- a/lib/fog/vsphere/requests/compute/vm_migrate.rb +++ b/lib/fog/vsphere/requests/compute/vm_migrate.rb @@ -5,7 +5,7 @@ module Fog def vm_migrate(options = {}) #priority is the only required option, and it has a sane default option. priority = options['priority'].nil? ? 'defaultPriority' : options["priority"] - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' # Find the VM Object search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true } @@ -24,7 +24,7 @@ module Fog class Mock def vm_migrate(options = {}) priority = options['priority'].nil? ? 'defaultPriority' : options["priority"] - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' { 'task_state' => 'success' } end end diff --git a/lib/fog/vsphere/requests/compute/vm_power_off.rb b/lib/fog/vsphere/requests/compute/vm_power_off.rb index 22d87e698..fc954d359 100644 --- a/lib/fog/vsphere/requests/compute/vm_power_off.rb +++ b/lib/fog/vsphere/requests/compute/vm_power_off.rb @@ -4,7 +4,7 @@ module Fog class Real def vm_power_off(options = {}) options = { 'force' => false }.merge(options) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true } vm_mob_ref = @connection.searchIndex.FindAllByUuid(search_filter).first @@ -25,7 +25,7 @@ module Fog class Mock def vm_power_off(options = {}) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' vm = get_virtual_machine(options['instance_uuid']) vm["power_state"] = "poweredOff" { diff --git a/lib/fog/vsphere/requests/compute/vm_power_on.rb b/lib/fog/vsphere/requests/compute/vm_power_on.rb index 58cb98c1a..40059cb66 100644 --- a/lib/fog/vsphere/requests/compute/vm_power_on.rb +++ b/lib/fog/vsphere/requests/compute/vm_power_on.rb @@ -3,7 +3,7 @@ module Fog class Vsphere class Real def vm_power_on(options = {}) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true } vm_mob_ref = @connection.searchIndex.FindAllByUuid(search_filter).first @@ -17,7 +17,7 @@ module Fog class Mock def vm_power_on(options = {}) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' { 'task_state' => 'success' } end end diff --git a/lib/fog/vsphere/requests/compute/vm_reboot.rb b/lib/fog/vsphere/requests/compute/vm_reboot.rb index 78d945525..7d3968214 100644 --- a/lib/fog/vsphere/requests/compute/vm_reboot.rb +++ b/lib/fog/vsphere/requests/compute/vm_reboot.rb @@ -4,7 +4,7 @@ module Fog class Real def vm_reboot(options = {}) options = { 'force' => false }.merge(options) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true } vm_mob_ref = @connection.searchIndex.FindAllByUuid(search_filter).first @@ -22,7 +22,7 @@ module Fog class Mock def vm_reboot(options = {}) - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' { 'task_state' => "running", 'reboot_type' => options['force'] ? 'reset_power' : 'reboot_guest' } end end diff --git a/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb b/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb index 28589bef0..ffff6bb04 100644 --- a/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb +++ b/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb @@ -3,8 +3,8 @@ module Fog class Vsphere class Real def vm_reconfig_cpus(options = {}) - raise ArgumentError, "cpus is a required parameter" unless options.has_key? 'cpus' - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "cpus is a required parameter" unless options.key? 'cpus' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' hardware_spec={'numCPUs' => options['cpus'], 'numCoresPerSocket' => options['corespersocket']} vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec ) end @@ -12,8 +12,8 @@ module Fog class Mock def vm_reconfig_cpus(options = {}) - raise ArgumentError, "cpus is a required parameter" unless options.has_key? 'cpus' - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "cpus is a required parameter" unless options.key? 'cpus' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' hardware_spec={'numCPUs' => options['cpus'], 'numCoresPerSocket' => options['corespersocket']} vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec ) end diff --git a/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb b/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb index 028e2f967..a491b9c0d 100644 --- a/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +++ b/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb @@ -3,8 +3,8 @@ module Fog class Vsphere class Real def vm_reconfig_hardware(options = {}) - raise ArgumentError, "hardware_spec is a required parameter" unless options.has_key? 'hardware_spec' - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "hardware_spec is a required parameter" unless options.key? 'hardware_spec' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' vm_mob_ref = get_vm_ref(options['instance_uuid']) task = vm_mob_ref.ReconfigVM_Task(:spec => RbVmomi::VIM.VirtualMachineConfigSpec(options['hardware_spec'])) task.wait_for_completion @@ -14,8 +14,8 @@ module Fog class Mock def vm_reconfig_hardware(options = {}) - raise ArgumentError, "hardware_spec is a required parameter" unless options.has_key? 'hardware_spec' - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "hardware_spec is a required parameter" unless options.key? 'hardware_spec' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' { 'task_state' => 'success' } end end diff --git a/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb b/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb index 860b607bc..fef328417 100644 --- a/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb +++ b/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb @@ -3,8 +3,8 @@ module Fog class Vsphere class Real def vm_reconfig_memory(options = {}) - raise ArgumentError, "memory is a required parameter" unless options.has_key? 'memory' - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "memory is a required parameter" unless options.key? 'memory' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' hardware_spec={'memoryMB' => options['memory']} vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec ) end @@ -12,8 +12,8 @@ module Fog class Mock def vm_reconfig_memory(options = {}) - raise ArgumentError, "memory is a required parameter" unless options.has_key? 'memory' - raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' + raise ArgumentError, "memory is a required parameter" unless options.key? 'memory' + raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid' hardware_spec={'memoryMB' => options['memory']} vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec ) end diff --git a/tests/aws/requests/auto_scaling/tag_tests.rb b/tests/aws/requests/auto_scaling/tag_tests.rb index 30e205c9d..f44506544 100644 --- a/tests/aws/requests/auto_scaling/tag_tests.rb +++ b/tests/aws/requests/auto_scaling/tag_tests.rb @@ -40,7 +40,7 @@ Shindo.tests('AWS::AutoScaling | tag requests', ['aws', 'auto_scaling']) do tests("#describe_auto_scaling_groups(#{asg_name}").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do body = Fog::AWS[:auto_scaling].describe_auto_scaling_groups('AutoScalingGroupNames' => asg_name).body auto_scaling_group = body['DescribeAutoScalingGroupsResult']['AutoScalingGroups'].first - returns(true) { auto_scaling_group.has_key?('Tags') } + returns(true) { auto_scaling_group.key?('Tags') } returns(true) { auto_scaling_group['Tags'].size == 1 } returns(true) { auto_scaling_group['Tags'].first == asg_tag } body diff --git a/tests/aws/requests/storage/versioning_tests.rb b/tests/aws/requests/storage/versioning_tests.rb index db2ce14ff..f6f455d09 100644 --- a/tests/aws/requests/storage/versioning_tests.rb +++ b/tests/aws/requests/storage/versioning_tests.rb @@ -116,7 +116,7 @@ Shindo.tests('Fog::Storage[:aws] | versioning', ["aws"]) do tests("deleting an object just stores a delete marker").returns(true) do file.destroy versions = Fog::Storage[:aws].get_bucket_object_versions(@aws_bucket_name) - versions.body['Versions'].first.has_key?('DeleteMarker') + versions.body['Versions'].first.key?('DeleteMarker') end tests("there are two versions: the original and the delete marker").returns(2) do @@ -126,7 +126,7 @@ Shindo.tests('Fog::Storage[:aws] | versioning', ["aws"]) do tests("deleting the delete marker makes the object available again").returns(file.version) do versions = Fog::Storage[:aws].get_bucket_object_versions(@aws_bucket_name) - delete_marker = versions.body['Versions'].find { |v| v.has_key?('DeleteMarker') } + delete_marker = versions.body['Versions'].find { |v| v.key?('DeleteMarker') } Fog::Storage[:aws].delete_object(@aws_bucket_name, file.key, 'versionId' => delete_marker['DeleteMarker']['VersionId']) res = Fog::Storage[:aws].get_object(@aws_bucket_name, file.key) @@ -157,10 +157,10 @@ Shindo.tests('Fog::Storage[:aws] | versioning', ["aws"]) do versions.body['Versions'].each do |version| object = version[version.keys.first] next if file_names.index(object['Key']).nil? - if !all_versions.has_key?(object['Key']) - all_versions[object['Key']] = version.has_key?('DeleteMarker') + if !all_versions.key?(object['Key']) + all_versions[object['Key']] = version.key?('DeleteMarker') else - all_versions[object['Key']] |= version.has_key?('DeleteMarker') + all_versions[object['Key']] |= version.key?('DeleteMarker') end end all_true = true diff --git a/tests/digitalocean/models/compute/flavor_tests.rb b/tests/digitalocean/models/compute/flavor_tests.rb index 8e753800b..322c94c14 100644 --- a/tests/digitalocean/models/compute/flavor_tests.rb +++ b/tests/digitalocean/models/compute/flavor_tests.rb @@ -20,7 +20,7 @@ Shindo.tests("Fog::Compute[:digitalocean] | flavor model", ['digitalocean', 'com end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/digitalocean/models/compute/image_tests.rb b/tests/digitalocean/models/compute/image_tests.rb index 261c5ba12..fc1606d59 100644 --- a/tests/digitalocean/models/compute/image_tests.rb +++ b/tests/digitalocean/models/compute/image_tests.rb @@ -21,7 +21,7 @@ Shindo.tests("Fog::Compute[:digitalocean] | image model", ['digitalocean', 'comp end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/digitalocean/models/compute/region_tests.rb b/tests/digitalocean/models/compute/region_tests.rb index c74d56584..5cb3ee731 100644 --- a/tests/digitalocean/models/compute/region_tests.rb +++ b/tests/digitalocean/models/compute/region_tests.rb @@ -20,7 +20,7 @@ Shindo.tests("Fog::Compute[:digitalocean] | region model", ['digitalocean', 'com end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/dreamhost/models/dns/record_tests.rb b/tests/dreamhost/models/dns/record_tests.rb index 80de636e0..ba89a882b 100644 --- a/tests/dreamhost/models/dns/record_tests.rb +++ b/tests/dreamhost/models/dns/record_tests.rb @@ -19,7 +19,7 @@ Shindo.tests("Fog::DNS[:dreamhost] | record", ['dreamhost', 'dns']) do test("#{attribute} method") { record.respond_to? attribute } end attributes.each do |attribute| - test("#{attribute} key") { model_attribute_hash.has_key? attribute } + test("#{attribute} key") { model_attribute_hash.key? attribute } end end diff --git a/tests/dreamhost/models/dns/zone_tests.rb b/tests/dreamhost/models/dns/zone_tests.rb index 2ec3ba269..e15a142bc 100644 --- a/tests/dreamhost/models/dns/zone_tests.rb +++ b/tests/dreamhost/models/dns/zone_tests.rb @@ -14,7 +14,7 @@ Shindo.tests("Fog::DNS[:dreamhost] | zone", ['dreamhost', 'dns']) do test("#{attribute} method") { zone.respond_to? attribute } end attributes.each do |attribute| - test("#{attribute} key") { model_attribute_hash.has_key? attribute } + test("#{attribute} key") { model_attribute_hash.key? attribute } end end diff --git a/tests/fogdocker/models/compute/image_tests.rb b/tests/fogdocker/models/compute/image_tests.rb index fcbbe0bc8..cf2ccab34 100644 --- a/tests/fogdocker/models/compute/image_tests.rb +++ b/tests/fogdocker/models/compute/image_tests.rb @@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute[:fogdocker] | image model', ['fogdocker']) do end tests("The attributes hash should have key") do (attributes-[:repo_tags]).each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/fogdocker/models/compute/server_tests.rb b/tests/fogdocker/models/compute/server_tests.rb index 5f36de823..59ce22744 100644 --- a/tests/fogdocker/models/compute/server_tests.rb +++ b/tests/fogdocker/models/compute/server_tests.rb @@ -36,7 +36,7 @@ Shindo.tests('Fog::Compute[:fogdocker] | server model', ['fogdocker']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/libvirt/models/compute/interface_tests.rb b/tests/libvirt/models/compute/interface_tests.rb index 524b0cfb6..7de691742 100644 --- a/tests/libvirt/models/compute/interface_tests.rb +++ b/tests/libvirt/models/compute/interface_tests.rb @@ -17,7 +17,7 @@ Shindo.tests('Fog::Compute[:libvirt] | interface model', ['libvirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/libvirt/models/compute/network_tests.rb b/tests/libvirt/models/compute/network_tests.rb index 09904534b..155a59878 100644 --- a/tests/libvirt/models/compute/network_tests.rb +++ b/tests/libvirt/models/compute/network_tests.rb @@ -17,7 +17,7 @@ Shindo.tests('Fog::Compute[:libvirt] | network model', ['libvirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/libvirt/models/compute/nic_tests.rb b/tests/libvirt/models/compute/nic_tests.rb index 6b4ff89dc..290bec211 100644 --- a/tests/libvirt/models/compute/nic_tests.rb +++ b/tests/libvirt/models/compute/nic_tests.rb @@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute[:libvirt] | nic model', ['libvirt']) do tests("The attributes hash should have key") do attributes.delete(:bridge) attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/libvirt/models/compute/pool_tests.rb b/tests/libvirt/models/compute/pool_tests.rb index 0cb4cd8fb..03946ab08 100644 --- a/tests/libvirt/models/compute/pool_tests.rb +++ b/tests/libvirt/models/compute/pool_tests.rb @@ -17,7 +17,7 @@ Shindo.tests('Fog::Compute[:libvirt] | interface model', ['libvirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/libvirt/models/compute/server_tests.rb b/tests/libvirt/models/compute/server_tests.rb index ea1b7f40b..8d731c345 100644 --- a/tests/libvirt/models/compute/server_tests.rb +++ b/tests/libvirt/models/compute/server_tests.rb @@ -48,7 +48,7 @@ Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do tests("The attributes hash should have key") do attributes.delete(:volumes) attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/libvirt/models/compute/volume_tests.rb b/tests/libvirt/models/compute/volume_tests.rb index fadd36be3..735a5f318 100644 --- a/tests/libvirt/models/compute/volume_tests.rb +++ b/tests/libvirt/models/compute/volume_tests.rb @@ -20,7 +20,7 @@ Shindo.tests('Fog::Compute[:libvirt] | volume model', ['libvirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/ovirt/models/compute/cluster_tests.rb b/tests/ovirt/models/compute/cluster_tests.rb index 004cce76b..ec6ab9ee5 100644 --- a/tests/ovirt/models/compute/cluster_tests.rb +++ b/tests/ovirt/models/compute/cluster_tests.rb @@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute[:ovirt] | cluster model', ['ovirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/ovirt/models/compute/interface_tests.rb b/tests/ovirt/models/compute/interface_tests.rb index 5fc836c09..591d08fe5 100644 --- a/tests/ovirt/models/compute/interface_tests.rb +++ b/tests/ovirt/models/compute/interface_tests.rb @@ -17,7 +17,7 @@ Shindo.tests('Fog::Compute[:ovirt] | interface model', ['ovirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/ovirt/models/compute/server_tests.rb b/tests/ovirt/models/compute/server_tests.rb index 06c0d8846..60d7e8669 100644 --- a/tests/ovirt/models/compute/server_tests.rb +++ b/tests/ovirt/models/compute/server_tests.rb @@ -41,7 +41,7 @@ Shindo.tests('Fog::Compute[:ovirt] | server model', ['ovirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/ovirt/models/compute/template_tests.rb b/tests/ovirt/models/compute/template_tests.rb index b831c458e..be7866ee4 100644 --- a/tests/ovirt/models/compute/template_tests.rb +++ b/tests/ovirt/models/compute/template_tests.rb @@ -18,7 +18,7 @@ Shindo.tests('Fog::Compute[:ovirt] | template model', ['ovirt']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/rackspace/auto_scale_tests.rb b/tests/rackspace/auto_scale_tests.rb index f9751eb04..9cafb8006 100644 --- a/tests/rackspace/auto_scale_tests.rb +++ b/tests/rackspace/auto_scale_tests.rb @@ -32,7 +32,7 @@ Shindo.tests('Fog::Rackspace::AutoScale', ['rackspace']) do returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_groups end tests('dfw region').succeeds do diff --git a/tests/rackspace/block_storage_tests.rb b/tests/rackspace/block_storage_tests.rb index 9c5cd39f4..4fd5d75dd 100644 --- a/tests/rackspace/block_storage_tests.rb +++ b/tests/rackspace/block_storage_tests.rb @@ -52,7 +52,7 @@ Shindo.tests('Fog::Rackspace::BlockStorage', ['rackspace']) do identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_volumes end tests('dfw region').succeeds do diff --git a/tests/rackspace/cdn_tests.rb b/tests/rackspace/cdn_tests.rb index 009048079..ecf719125 100644 --- a/tests/rackspace/cdn_tests.rb +++ b/tests/rackspace/cdn_tests.rb @@ -48,7 +48,7 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.get_containers end diff --git a/tests/rackspace/compute_tests.rb b/tests/rackspace/compute_tests.rb index e15fd7c66..492846c21 100644 --- a/tests/rackspace/compute_tests.rb +++ b/tests/rackspace/compute_tests.rb @@ -49,7 +49,7 @@ Shindo.tests('Rackspace | Compute', ['rackspace']) do identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_flavors end diff --git a/tests/rackspace/compute_v2_tests.rb b/tests/rackspace/compute_v2_tests.rb index 2def6058f..2e4412c67 100644 --- a/tests/rackspace/compute_v2_tests.rb +++ b/tests/rackspace/compute_v2_tests.rb @@ -51,7 +51,7 @@ Shindo.tests('Fog::Compute::RackspaceV2', ['rackspace']) do returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_flavors end tests('dfw region').succeeds do diff --git a/tests/rackspace/databases_tests.rb b/tests/rackspace/databases_tests.rb index 3bd6bcaa3..e1f6557ff 100644 --- a/tests/rackspace/databases_tests.rb +++ b/tests/rackspace/databases_tests.rb @@ -51,7 +51,7 @@ Shindo.tests('Fog::Rackspace::Databases', ['rackspace']) do |variable| identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.flavors end tests('dfw region').succeeds do diff --git a/tests/rackspace/dns_tests.rb b/tests/rackspace/dns_tests.rb index 505b4ad0b..a4aeb3740 100644 --- a/tests/rackspace/dns_tests.rb +++ b/tests/rackspace/dns_tests.rb @@ -54,7 +54,7 @@ Shindo.tests('Fog::DNS::Rackspace', ['rackspace']) do identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_domains end tests('custom endpoint') do diff --git a/tests/rackspace/load_balancer_tests.rb b/tests/rackspace/load_balancer_tests.rb index 48237c107..b25264c99 100644 --- a/tests/rackspace/load_balancer_tests.rb +++ b/tests/rackspace/load_balancer_tests.rb @@ -51,7 +51,7 @@ Shindo.tests('Fog::Rackspace::LoadBalancers', ['rackspace']) do returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_load_balancers end tests('dfw region').succeeds do diff --git a/tests/rackspace/monitoring_tests.rb b/tests/rackspace/monitoring_tests.rb index 22f7cdf47..f98b12c59 100644 --- a/tests/rackspace/monitoring_tests.rb +++ b/tests/rackspace/monitoring_tests.rb @@ -32,7 +32,7 @@ Shindo.tests('Fog::Rackspace::Monitoring', ['rackspace','rackspace_monitoring']) returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_entities end tests('custom endpoint') do diff --git a/tests/rackspace/queues_tests.rb b/tests/rackspace/queues_tests.rb index b187693b7..2bc04c70e 100644 --- a/tests/rackspace/queues_tests.rb +++ b/tests/rackspace/queues_tests.rb @@ -35,7 +35,7 @@ Shindo.tests('Fog::Rackspace::Queues', ['rackspace']) do identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.queues end tests('dfw region').succeeds do diff --git a/tests/rackspace/requests/identity/token_tests.rb b/tests/rackspace/requests/identity/token_tests.rb index 29a4c2bdb..9570599ed 100644 --- a/tests/rackspace/requests/identity/token_tests.rb +++ b/tests/rackspace/requests/identity/token_tests.rb @@ -58,7 +58,7 @@ Shindo.tests('Fog::Rackspace::Identity | tokens', ['rackspace']) do connection = identity_service.instance_variable_get("@connection") excon = connection.instance_variable_get("@excon") data = excon.instance_variable_get("@data") - data.has_key?(:ssl_verify_peer) + data.key?(:ssl_verify_peer) end end diff --git a/tests/rackspace/storage_tests.rb b/tests/rackspace/storage_tests.rb index 5a66f25d3..b81963fea 100644 --- a/tests/rackspace/storage_tests.rb +++ b/tests/rackspace/storage_tests.rb @@ -46,7 +46,7 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } - returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) } + returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.head_containers end tests('dfw region').succeeds do diff --git a/tests/vsphere/models/compute/server_tests.rb b/tests/vsphere/models/compute/server_tests.rb index 261fc2449..4f692f752 100644 --- a/tests/vsphere/models/compute/server_tests.rb +++ b/tests/vsphere/models/compute/server_tests.rb @@ -34,7 +34,7 @@ Shindo.tests('Fog::Compute[:vsphere] | server model', ['vsphere']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/vsphere/requests/compute/current_time_tests.rb b/tests/vsphere/requests/compute/current_time_tests.rb index 9b2f0a2a8..a19755da4 100644 --- a/tests/vsphere/requests/compute/current_time_tests.rb +++ b/tests/vsphere/requests/compute/current_time_tests.rb @@ -5,7 +5,7 @@ Shindo.tests('Fog::Compute[:vsphere] | current_time request', ['vsphere']) do tests('The response should') do response = compute.current_time test('be a kind of Hash') { response.kind_of? Hash } - test('have a current_time key') { response.has_key? 'current_time' } + test('have a current_time key') { response.key? 'current_time' } test('have a current_time key with a Time value') { response['current_time'].kind_of? Time } end diff --git a/tests/vsphere/requests/compute/vm_clone_tests.rb b/tests/vsphere/requests/compute/vm_clone_tests.rb index 0dd338321..5d8abc5d3 100644 --- a/tests/vsphere/requests/compute/vm_clone_tests.rb +++ b/tests/vsphere/requests/compute/vm_clone_tests.rb @@ -12,7 +12,7 @@ Shindo.tests("Fog::Compute[:vsphere] | vm_clone request", 'vsphere') do response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'wait' => true) test("be a kind of Hash") { response.kind_of? Hash } %w{ vm_ref new_vm task_ref }.each do |key| - test("have a #{key} key") { response.has_key? key } + test("have a #{key} key") { response.key? key } end test("creates a new server") { compute.servers.size == servers_size+1 } test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' } @@ -23,7 +23,7 @@ Shindo.tests("Fog::Compute[:vsphere] | vm_clone request", 'vsphere') do response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true) test("be a kind of Hash") { response.kind_of? Hash } %w{ vm_ref new_vm task_ref }.each do |key| - test("have a #{key} key") { response.has_key? key } + test("have a #{key} key") { response.key? key } end test("creates a new server") { compute.servers.size == servers_size+1 } test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' } @@ -34,7 +34,7 @@ Shindo.tests("Fog::Compute[:vsphere] | vm_clone request", 'vsphere') do response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true) test("be a kind of Hash") { response.kind_of? Hash } %w{ vm_ref new_vm task_ref }.each do |key| - test("have a #{key} key") { response.has_key? key } + test("have a #{key} key") { response.key? key } end test("creates a new server") { compute.servers.size == servers_size+1 } test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm_linked' } diff --git a/tests/vsphere/requests/compute/vm_config_vnc_tests.rb b/tests/vsphere/requests/compute/vm_config_vnc_tests.rb index 9350d069d..cb126cd10 100644 --- a/tests/vsphere/requests/compute/vm_config_vnc_tests.rb +++ b/tests/vsphere/requests/compute/vm_config_vnc_tests.rb @@ -8,12 +8,12 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_config_vnc request', ['vsphere']) do tests('The response should') do response = compute.vm_config_vnc('instance_uuid' => reconfig_target).merge(vnc_spec) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } + test('should have a task_state key') { response.key? 'task_state' } end tests('VNC attrs response should') do response = compute.vm_get_vnc(reconfig_target) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a port key') { response.has_key? :port } + test('should have a port key') { response.key? :port } end end diff --git a/tests/vsphere/requests/compute/vm_destroy_tests.rb b/tests/vsphere/requests/compute/vm_destroy_tests.rb index a41b3743d..1b4a5d661 100644 --- a/tests/vsphere/requests/compute/vm_destroy_tests.rb +++ b/tests/vsphere/requests/compute/vm_destroy_tests.rb @@ -7,7 +7,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_destroy request', ['vsphere']) do tests('The response should') do response = compute.vm_destroy('instance_uuid' => booted_vm) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } + test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do diff --git a/tests/vsphere/requests/compute/vm_migrate_tests.rb b/tests/vsphere/requests/compute/vm_migrate_tests.rb index fa6624480..74f425fc4 100644 --- a/tests/vsphere/requests/compute/vm_migrate_tests.rb +++ b/tests/vsphere/requests/compute/vm_migrate_tests.rb @@ -7,7 +7,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_migrate request', ['vsphere']) do tests('The response should') do response = compute.vm_migrate('instance_uuid' => powered_on_vm) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } + test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do diff --git a/tests/vsphere/requests/compute/vm_power_off_tests.rb b/tests/vsphere/requests/compute/vm_power_off_tests.rb index e8684dbee..f961bb3ab 100644 --- a/tests/vsphere/requests/compute/vm_power_off_tests.rb +++ b/tests/vsphere/requests/compute/vm_power_off_tests.rb @@ -7,8 +7,8 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_power_off request', ['vsphere']) do tests('The response should') do response = compute.vm_power_off('instance_uuid' => powered_on_vm) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } - test('should have a power_off_type key') { response.has_key? 'power_off_type' } + test('should have a task_state key') { response.key? 'task_state' } + test('should have a power_off_type key') { response.key? 'power_off_type' } end # When forcing the shutdown, we expect the result to be diff --git a/tests/vsphere/requests/compute/vm_power_on_tests.rb b/tests/vsphere/requests/compute/vm_power_on_tests.rb index 344f63cd6..1ee007fee 100644 --- a/tests/vsphere/requests/compute/vm_power_on_tests.rb +++ b/tests/vsphere/requests/compute/vm_power_on_tests.rb @@ -7,7 +7,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_power_on request', ['vsphere']) do tests('The response should') do response = compute.vm_power_on('instance_uuid' => powered_off_vm) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } + test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do diff --git a/tests/vsphere/requests/compute/vm_reboot_tests.rb b/tests/vsphere/requests/compute/vm_reboot_tests.rb index 4886f6dad..241891832 100644 --- a/tests/vsphere/requests/compute/vm_reboot_tests.rb +++ b/tests/vsphere/requests/compute/vm_reboot_tests.rb @@ -7,8 +7,8 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_reboot request', ['vsphere']) do tests('The response should') do response = compute.vm_reboot('instance_uuid' => powered_on_vm) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } - test('should have a reboot_type key') { response.has_key? 'reboot_type' } + test('should have a task_state key') { response.key? 'task_state' } + test('should have a reboot_type key') { response.key? 'reboot_type' } end # When forcing the shutdown, we expect the result to be diff --git a/tests/vsphere/requests/compute/vm_reconfig_cpus_tests.rb b/tests/vsphere/requests/compute/vm_reconfig_cpus_tests.rb index 63bd7afc4..e0eeadb62 100644 --- a/tests/vsphere/requests/compute/vm_reconfig_cpus_tests.rb +++ b/tests/vsphere/requests/compute/vm_reconfig_cpus_tests.rb @@ -8,7 +8,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_reconfig_cpus request', ['vsphere']) d tests('The response should') do response = compute.vm_reconfig_cpus('instance_uuid' => reconfig_target, 'cpus' => reconfig_spec) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } + test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do diff --git a/tests/vsphere/requests/compute/vm_reconfig_hardware_tests.rb b/tests/vsphere/requests/compute/vm_reconfig_hardware_tests.rb index 0f7311822..db73b3e59 100644 --- a/tests/vsphere/requests/compute/vm_reconfig_hardware_tests.rb +++ b/tests/vsphere/requests/compute/vm_reconfig_hardware_tests.rb @@ -8,7 +8,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_reconfig_hardware request', ['vsphere' tests('The response should') do response = compute.vm_reconfig_hardware('instance_uuid' => reconfig_target, 'hardware_spec' => reconfig_spec) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } + test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do diff --git a/tests/vsphere/requests/compute/vm_reconfig_memory_tests.rb b/tests/vsphere/requests/compute/vm_reconfig_memory_tests.rb index 68c7665fe..64aa26941 100644 --- a/tests/vsphere/requests/compute/vm_reconfig_memory_tests.rb +++ b/tests/vsphere/requests/compute/vm_reconfig_memory_tests.rb @@ -8,7 +8,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_reconfig_memory request', ['vsphere']) tests('The response should') do response = compute.vm_reconfig_memory('instance_uuid' => reconfig_target, 'memory' => reconfig_spec) test('be a kind of Hash') { response.kind_of? Hash } - test('should have a task_state key') { response.has_key? 'task_state' } + test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do diff --git a/tests/xenserver/models/compute/console_test.rb b/tests/xenserver/models/compute/console_test.rb index 6d6be818d..68177c8c5 100644 --- a/tests/xenserver/models/compute/console_test.rb +++ b/tests/xenserver/models/compute/console_test.rb @@ -20,7 +20,7 @@ Shindo.tests('Fog::Compute[:xenserver] | console model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/host_cpu_tests.rb b/tests/xenserver/models/compute/host_cpu_tests.rb index 48d59264c..388f000f5 100644 --- a/tests/xenserver/models/compute/host_cpu_tests.rb +++ b/tests/xenserver/models/compute/host_cpu_tests.rb @@ -28,7 +28,7 @@ Shindo.tests('Fog::Compute[:xenserver] | HostCpu model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/host_metrics_tests.rb b/tests/xenserver/models/compute/host_metrics_tests.rb index 183efe66d..87ea1403f 100644 --- a/tests/xenserver/models/compute/host_metrics_tests.rb +++ b/tests/xenserver/models/compute/host_metrics_tests.rb @@ -20,7 +20,7 @@ Shindo.tests('Fog::Compute[:xenserver] | HostMetrics model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/host_tests.rb b/tests/xenserver/models/compute/host_tests.rb index da77a945d..1c9f5b9ae 100644 --- a/tests/xenserver/models/compute/host_tests.rb +++ b/tests/xenserver/models/compute/host_tests.rb @@ -39,7 +39,7 @@ Shindo.tests('Fog::Compute[:xenserver] | host model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/network_tests.rb b/tests/xenserver/models/compute/network_tests.rb index a75d2694e..0bf2342ad 100644 --- a/tests/xenserver/models/compute/network_tests.rb +++ b/tests/xenserver/models/compute/network_tests.rb @@ -33,7 +33,7 @@ Shindo.tests('Fog::Compute[:network] | network model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/pbd_tests.rb b/tests/xenserver/models/compute/pbd_tests.rb index 7443f4582..6ea3246ae 100644 --- a/tests/xenserver/models/compute/pbd_tests.rb +++ b/tests/xenserver/models/compute/pbd_tests.rb @@ -24,7 +24,7 @@ Shindo.tests('Fog::Compute[:xenserver] | PBD model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/pif_tests.rb b/tests/xenserver/models/compute/pif_tests.rb index 9b2a03abe..cc46713a2 100644 --- a/tests/xenserver/models/compute/pif_tests.rb +++ b/tests/xenserver/models/compute/pif_tests.rb @@ -36,7 +36,7 @@ Shindo.tests('Fog::Compute[:xenserver] | PIF model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/pool_tests.rb b/tests/xenserver/models/compute/pool_tests.rb index 797e6834b..5864d1f66 100644 --- a/tests/xenserver/models/compute/pool_tests.rb +++ b/tests/xenserver/models/compute/pool_tests.rb @@ -29,7 +29,7 @@ Shindo.tests('Fog::Compute[:xenserver] | Pool model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/server_tests.rb b/tests/xenserver/models/compute/server_tests.rb index a7a1cc0e2..aef61264b 100644 --- a/tests/xenserver/models/compute/server_tests.rb +++ b/tests/xenserver/models/compute/server_tests.rb @@ -70,7 +70,7 @@ Shindo.tests('Fog::Compute[:xenserver] | server model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/storage_repository_tests.rb b/tests/xenserver/models/compute/storage_repository_tests.rb index 005f53207..2783e326b 100644 --- a/tests/xenserver/models/compute/storage_repository_tests.rb +++ b/tests/xenserver/models/compute/storage_repository_tests.rb @@ -40,7 +40,7 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver'] end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/vbd_tests.rb b/tests/xenserver/models/compute/vbd_tests.rb index d024ea47b..e9fc1e979 100644 --- a/tests/xenserver/models/compute/vbd_tests.rb +++ b/tests/xenserver/models/compute/vbd_tests.rb @@ -43,7 +43,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VBD model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/vif_tests.rb b/tests/xenserver/models/compute/vif_tests.rb index 15ff1143a..fc5ffb0ee 100644 --- a/tests/xenserver/models/compute/vif_tests.rb +++ b/tests/xenserver/models/compute/vif_tests.rb @@ -31,7 +31,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VIF model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end diff --git a/tests/xenserver/models/compute/vlan_tests.rb b/tests/xenserver/models/compute/vlan_tests.rb index a41fe6042..9a4691f90 100644 --- a/tests/xenserver/models/compute/vlan_tests.rb +++ b/tests/xenserver/models/compute/vlan_tests.rb @@ -26,7 +26,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VLAN model', ['xenserver']) do end tests("The attributes hash should have key") do attributes.each do |attribute| - test("#{attribute}") { model_attribute_hash.has_key? attribute } + test("#{attribute}") { model_attribute_hash.key? attribute } end end end