diff options
Diffstat (limited to 'knife')
-rw-r--r-- | knife/lib/chef/knife/acl_bulk_add.rb | 2 | ||||
-rw-r--r-- | knife/lib/chef/knife/acl_bulk_remove.rb | 2 | ||||
-rw-r--r-- | knife/lib/chef/knife/core/generic_presenter.rb | 2 | ||||
-rw-r--r-- | knife/lib/chef/knife/core/subcommand_loader.rb | 2 | ||||
-rw-r--r-- | knife/lib/chef/knife/version.rb | 2 | ||||
-rw-r--r-- | knife/spec/knife_spec_helper.rb | 4 | ||||
-rw-r--r-- | knife/spec/support/platform_helpers.rb | 2 | ||||
-rw-r--r-- | knife/spec/unit/knife/environment_list_spec.rb | 2 |
8 files changed, 9 insertions, 9 deletions
diff --git a/knife/lib/chef/knife/acl_bulk_add.rb b/knife/lib/chef/knife/acl_bulk_add.rb index 4992fe2afa..bdd2e0fdc4 100644 --- a/knife/lib/chef/knife/acl_bulk_add.rb +++ b/knife/lib/chef/knife/acl_bulk_add.rb @@ -56,7 +56,7 @@ class Chef objects_to_modify = [] all_objects = rest.get_rest(object_type) - objects_to_modify = all_objects.keys.select { |object_name| object_name =~ object_name_matcher } + objects_to_modify = all_objects.keys.grep(object_name_matcher) if objects_to_modify.empty? ui.info "No #{object_type} match the expression /#{regex}/" diff --git a/knife/lib/chef/knife/acl_bulk_remove.rb b/knife/lib/chef/knife/acl_bulk_remove.rb index 0f35f1e2fb..fce76f250d 100644 --- a/knife/lib/chef/knife/acl_bulk_remove.rb +++ b/knife/lib/chef/knife/acl_bulk_remove.rb @@ -61,7 +61,7 @@ class Chef objects_to_modify = [] all_objects = rest.get_rest(object_type) - objects_to_modify = all_objects.keys.select { |object_name| object_name =~ object_name_matcher } + objects_to_modify = all_objects.keys.grep(object_name_matcher) if objects_to_modify.empty? ui.info "No #{object_type} match the expression /#{regex}/" diff --git a/knife/lib/chef/knife/core/generic_presenter.rb b/knife/lib/chef/knife/core/generic_presenter.rb index 850bfa8b3d..214ffd340b 100644 --- a/knife/lib/chef/knife/core/generic_presenter.rb +++ b/knife/lib/chef/knife/core/generic_presenter.rb @@ -140,7 +140,7 @@ class Chef end def format_list_for_display(list) - config[:with_uri] ? list : list.keys.sort { |a, b| a <=> b } + config[:with_uri] ? list : list.keys.sort end def format_for_display(data) diff --git a/knife/lib/chef/knife/core/subcommand_loader.rb b/knife/lib/chef/knife/core/subcommand_loader.rb index 0f84dbb176..ddcaeffd0c 100644 --- a/knife/lib/chef/knife/core/subcommand_loader.rb +++ b/knife/lib/chef/knife/core/subcommand_loader.rb @@ -184,7 +184,7 @@ class Chef # @return [Array<String>] # def positional_arguments(args) - args.select { |arg| arg =~ /^(([[:alnum:]])[[:alnum:]\_\-]+)$/ } + args.grep(/^(([[:alnum:]])[[:alnum:]\_\-]+)$/) end # Returns an Array of paths to knife commands located in diff --git a/knife/lib/chef/knife/version.rb b/knife/lib/chef/knife/version.rb index 12504241cd..d72792251f 100644 --- a/knife/lib/chef/knife/version.rb +++ b/knife/lib/chef/knife/version.rb @@ -17,7 +17,7 @@ class Chef class Knife KNIFE_ROOT = File.expand_path("../..", __dir__) - VERSION = "17.9.18".freeze + VERSION = "17.9.23".freeze end end diff --git a/knife/spec/knife_spec_helper.rb b/knife/spec/knife_spec_helper.rb index 7395d2759b..5a3c0761d5 100644 --- a/knife/spec/knife_spec_helper.rb +++ b/knife/spec/knife_spec_helper.rb @@ -78,8 +78,8 @@ require "spec/support/shared/matchers/match_environment_variable" # Excludes support/platforms by default # Do not change the gsub. Dir["spec/support/**/*.rb"] - .reject { |f| f =~ %r{^spec/support/platforms} } - .reject { |f| f =~ %r{^spec/support/pedant} } + .grep_v(%r{^spec/support/platforms}) + .grep_v(%r{^spec/support/pedant}) .map { |f| f.gsub(/.rb$/, "") } .map { |f| f.gsub(%r{spec/}, "") } .each { |f| require f } diff --git a/knife/spec/support/platform_helpers.rb b/knife/spec/support/platform_helpers.rb index a3fb95e069..4d3acbcb33 100644 --- a/knife/spec/support/platform_helpers.rb +++ b/knife/spec/support/platform_helpers.rb @@ -168,7 +168,7 @@ def wpar? end def supports_cloexec? - Fcntl.const_defined?("F_SETFD") && Fcntl.const_defined?("FD_CLOEXEC") + Fcntl.const_defined?(:F_SETFD) && Fcntl.const_defined?(:FD_CLOEXEC) end def selinux_enabled? diff --git a/knife/spec/unit/knife/environment_list_spec.rb b/knife/spec/unit/knife/environment_list_spec.rb index 4f44a93f60..5090596815 100644 --- a/knife/spec/unit/knife/environment_list_spec.rb +++ b/knife/spec/unit/knife/environment_list_spec.rb @@ -39,7 +39,7 @@ describe Chef::Knife::EnvironmentList do end it "should print the environment names in a sorted list" do - names = @environments.keys.sort { |a, b| a <=> b } + names = @environments.keys.sort expect(@knife).to receive(:output).with(names) @knife.run end |