knife 17.9.9 → 17.9.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3642bb965e5c59528178bdf9ee38bb1a2163587830159d58f72a85fb0d747e75
4
- data.tar.gz: 890a3eb24418163b5b4380514cb89b3896deb002d034999206aa42c252697b96
3
+ metadata.gz: 38b44d2b8c6f86ac93d2803ec55b87fc55d63e5de3c3cd167f4495fe54dd1fb0
4
+ data.tar.gz: aaf3fc0aba59a4d1e38d6df2098053c4b3c12d4f4aca84e62ca1d338717c5fc7
5
5
  SHA512:
6
- metadata.gz: d03a7372abe2fa0d306dbedb0c6cb9d903c8515eeb51c377f5d37a933a4828fed0e9e7e554ef006b3bc767420e9d6e4ff58f9aaa961f9ca62a64fc1075092651
7
- data.tar.gz: f582e2289db8c047aff0bdc63e9017f5d535961622e71cbf00d9d89e51d1ae170ab786b0938194439dc98dd35ccd8e956c0d2120fd867d97d5cb3b997d706609
6
+ metadata.gz: dc6634edc2cd46990071712a5660883babe15c70d96426b4c32e2a66a885026c5a0fc9a087cd0336944d63f1b3919e5755e903ed83cbd5f0d97c456d6eb35a78
7
+ data.tar.gz: 935ff218ca8290c8cf384faea1dfc42c19704b993922ad40755067fca5798a7199e8c57fab84ceebd8f7f0645a2c040cb211dc0d36334f5027162233add2877d
@@ -56,7 +56,7 @@ class Chef
56
56
 
57
57
  objects_to_modify = []
58
58
  all_objects = rest.get_rest(object_type)
59
- objects_to_modify = all_objects.keys.select { |object_name| object_name =~ object_name_matcher }
59
+ objects_to_modify = all_objects.keys.grep(object_name_matcher)
60
60
 
61
61
  if objects_to_modify.empty?
62
62
  ui.info "No #{object_type} match the expression /#{regex}/"
@@ -61,7 +61,7 @@ class Chef
61
61
 
62
62
  objects_to_modify = []
63
63
  all_objects = rest.get_rest(object_type)
64
- objects_to_modify = all_objects.keys.select { |object_name| object_name =~ object_name_matcher }
64
+ objects_to_modify = all_objects.keys.grep(object_name_matcher)
65
65
 
66
66
  if objects_to_modify.empty?
67
67
  ui.info "No #{object_type} match the expression /#{regex}/"
@@ -20,6 +20,7 @@ require_relative "../knife"
20
20
  require_relative "data_bag_secret_options"
21
21
  require "chef-utils/dist" unless defined?(ChefUtils::Dist)
22
22
  require "license_acceptance/cli_flags/mixlib_cli"
23
+ require "chef/json_compat" unless defined?(Chef::JSONCompat) # can't be lazy loaded since it's used in options
23
24
 
24
25
  module LicenseAcceptance
25
26
  autoload :Acceptor, "license_acceptance/acceptor"
@@ -416,9 +417,6 @@ class Chef
416
417
  attr_reader :connection
417
418
 
418
419
  deps do
419
- require "erubis" unless defined?(Erubis)
420
- require "net/ssh" unless defined?(Net::SSH)
421
- require "chef/json_compat" unless defined?(Chef::JSONCompat)
422
420
  require "chef-config/path_helper" unless defined?(ChefConfig::PathHelper)
423
421
  require_relative "bootstrap/chef_vault_handler"
424
422
  require_relative "bootstrap/client_builder"
@@ -544,6 +542,7 @@ class Chef
544
542
  end
545
543
 
546
544
  def render_template
545
+ require "erubis" unless defined?(Erubis)
547
546
  @config[:first_boot_attributes] = first_boot_attributes
548
547
  template_file = find_template
549
548
  template = IO.read(template_file).chomp
@@ -62,7 +62,7 @@ class Chef
62
62
 
63
63
  # Exclude knife/chef/version. It's not a knife command, and force-loading
64
64
  # when we load all of these files will emit constant-already-defined warnings
65
- next if rel_path =~ version_file_match
65
+ next if rel_path&.match?(version_file_match)
66
66
 
67
67
  subcommand_files[rel_path] = file
68
68
  end
@@ -140,7 +140,7 @@ class Chef
140
140
  end
141
141
 
142
142
  def format_list_for_display(list)
143
- config[:with_uri] ? list : list.keys.sort { |a, b| a <=> b }
143
+ config[:with_uri] ? list : list.keys.sort
144
144
  end
145
145
 
146
146
  def format_for_display(data)
@@ -151,7 +151,7 @@ class Chef
151
151
  rel_path = knife_file[/#{KNIFE_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/, 1]
152
152
  # Exclude version.rb file for the gem. It's not a knife command, and force-loading it later
153
153
  # because loaded via in subcommand files generates CLI warnings about its consts already having been defined
154
- next if knife_file =~ version_file_match
154
+ next if knife_file&.match?(version_file_match)
155
155
 
156
156
  subcommand_files[rel_path] = knife_file
157
157
  end
@@ -184,7 +184,7 @@ class Chef
184
184
  # @return [Array<String>]
185
185
  #
186
186
  def positional_arguments(args)
187
- args.select { |arg| arg =~ /^(([[:alnum:]])[[:alnum:]\_\-]+)$/ }
187
+ args.grep(/^(([[:alnum:]])[[:alnum:]\_\-]+)$/)
188
188
  end
189
189
 
190
190
  # Returns an Array of paths to knife commands located in
@@ -17,7 +17,7 @@
17
17
  class Chef
18
18
  class Knife
19
19
  KNIFE_ROOT = File.expand_path("../..", __dir__)
20
- VERSION = "17.9.9".freeze
20
+ VERSION = "17.9.26".freeze
21
21
  end
22
22
  end
23
23
 
@@ -78,8 +78,8 @@ require "spec/support/shared/matchers/match_environment_variable"
78
78
  # Excludes support/platforms by default
79
79
  # Do not change the gsub.
80
80
  Dir["spec/support/**/*.rb"]
81
- .reject { |f| f =~ %r{^spec/support/platforms} }
82
- .reject { |f| f =~ %r{^spec/support/pedant} }
81
+ .grep_v(%r{^spec/support/platforms})
82
+ .grep_v(%r{^spec/support/pedant})
83
83
  .map { |f| f.gsub(/.rb$/, "") }
84
84
  .map { |f| f.gsub(%r{spec/}, "") }
85
85
  .each { |f| require f }
@@ -168,7 +168,7 @@ def wpar?
168
168
  end
169
169
 
170
170
  def supports_cloexec?
171
- Fcntl.const_defined?("F_SETFD") && Fcntl.const_defined?("FD_CLOEXEC")
171
+ Fcntl.const_defined?(:F_SETFD) && Fcntl.const_defined?(:FD_CLOEXEC)
172
172
  end
173
173
 
174
174
  def selinux_enabled?
@@ -39,7 +39,7 @@ describe Chef::Knife::EnvironmentList do
39
39
  end
40
40
 
41
41
  it "should print the environment names in a sorted list" do
42
- names = @environments.keys.sort { |a, b| a <=> b }
42
+ names = @environments.keys.sort
43
43
  expect(@knife).to receive(:output).with(names)
44
44
  @knife.run
45
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.9.9
4
+ version: 17.9.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-17 00:00:00.000000000 Z
11
+ date: 2022-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config