diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 14:55:20 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 15:08:43 -0700 |
commit | 21189d25a9385aa9ff3368716824b8333475a08b (patch) | |
tree | d4316d70ff88b5a43ffff90d04bd789da51cf9d4 /lib/chef/knife | |
parent | fb6c052ae6d58db2499cf04ef0595d1e06a4c13c (diff) | |
download | chef-21189d25a9385aa9ff3368716824b8333475a08b.tar.gz |
fix Style/PreferredHashMethods
absolutely hard requirement on the fixes that went into chef-config 2.2.11, so the
floor of that gem is bumped up.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r-- | lib/chef/knife/cookbook_show.rb | 8 | ||||
-rw-r--r-- | lib/chef/knife/cookbook_upload.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 6 | ||||
-rw-r--r-- | lib/chef/knife/data_bag_secret_options.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife/ssh.rb | 4 |
5 files changed, 12 insertions, 12 deletions
diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb index 78951d00c7..46ed7a1aa6 100644 --- a/lib/chef/knife/cookbook_show.rb +++ b/lib/chef/knife/cookbook_show.rb @@ -58,13 +58,13 @@ class Chef case @name_args.length when 4 # We are showing a specific file node = Hash.new - node[:fqdn] = config[:fqdn] if config.has_key?(:fqdn) - node[:platform] = config[:platform] if config.has_key?(:platform) - node[:platform_version] = config[:platform_version] if config.has_key?(:platform_version) + node[:fqdn] = config[:fqdn] if config.key?(:fqdn) + node[:platform] = config[:platform] if config.key?(:platform) + node[:platform_version] = config[:platform_version] if config.key?(:platform_version) class << node def attribute?(name) # rubocop:disable Lint/NestedMethodDefinition - has_key?(name) + key?(name) end end diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb index b19c352b79..67a5580860 100644 --- a/lib/chef/knife/cookbook_upload.rb +++ b/lib/chef/knife/cookbook_upload.rb @@ -169,7 +169,7 @@ class Chef upload_set = {} @name_args.each do |cookbook_name| begin - if ! upload_set.has_key?(cookbook_name) + if ! upload_set.key?(cookbook_name) upload_set[cookbook_name] = cookbook_repo[cookbook_name] if config[:depends] upload_set[cookbook_name].metadata.dependencies.each_key { |dep| @name_args << dep } diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index bb20780590..4e21564c52 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -45,7 +45,7 @@ class Chef end def validation_key - if @chef_config.has_key?(:validation_key) && + if @chef_config.key?(:validation_key) && File.exist?(File.expand_path(@chef_config[:validation_key])) IO.read(File.expand_path(@chef_config[:validation_key])) else @@ -105,14 +105,14 @@ class Chef # We configure :verify_api_cert only when it's overridden on the CLI # or when specified in the knife config. - if !@config[:node_verify_api_cert].nil? || knife_config.has_key?(:verify_api_cert) + if !@config[:node_verify_api_cert].nil? || knife_config.key?(:verify_api_cert) value = @config[:node_verify_api_cert].nil? ? knife_config[:verify_api_cert] : @config[:node_verify_api_cert] client_rb << %Q{verify_api_cert #{value}\n} end # We configure :ssl_verify_mode only when it's overridden on the CLI # or when specified in the knife config. - if @config[:node_ssl_verify_mode] || knife_config.has_key?(:ssl_verify_mode) + if @config[:node_ssl_verify_mode] || knife_config.key?(:ssl_verify_mode) value = case @config[:node_ssl_verify_mode] when "peer" :verify_peer diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb index 62a3e71ec5..6e800add89 100644 --- a/lib/chef/knife/data_bag_secret_options.rb +++ b/lib/chef/knife/data_bag_secret_options.rb @@ -118,7 +118,7 @@ class Chef end def has_cl_secret? - Chef::Config[:knife].has_key?(:cl_secret) + Chef::Config[:knife].key?(:cl_secret) end def self.set_cl_secret(s) @@ -126,7 +126,7 @@ class Chef end def has_cl_secret_file? - Chef::Config[:knife].has_key?(:cl_secret_file) + Chef::Config[:knife].key?(:cl_secret_file) end def self.set_cl_secret_file(sf) diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 74e457ac8e..cd29b62b75 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -561,7 +561,7 @@ class Chef # use ssh_password_ng to determine if we're coming from knife ssh or from the other utilities. The other utilties can # also be patched to use ssh_password_ng easily as long they follow the convention that the default is false. def configure_password - if config.has_key?(:ssh_password_ng) && config[:ssh_password_ng].nil? + if config.key?(:ssh_password_ng) && config[:ssh_password_ng].nil? # If the parameter is called on the command line with no value # it will set :ssh_password_ng = nil # This is where we want to trigger a prompt for password @@ -571,7 +571,7 @@ class Chef # using an old config[:ssh_password]. this is backwards compatibility. all knife cloud plugins should # be updated to use ssh_password_ng with a default of false and ssh_password should be retired, (but # we'll still need to use the ssh_password out of knife.rb if we find that). - ssh_password = config.has_key?(:ssh_password_ng) ? config[:ssh_password_ng] : config[:ssh_password] + ssh_password = config.key?(:ssh_password_ng) ? config[:ssh_password_ng] : config[:ssh_password] # Otherwise, the password has either been specified on the command line, # in knife.rb, or key based auth will be attempted config[:ssh_password] = get_stripped_unfrozen_value(ssh_password || |