diff options
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/cookbook_version.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/ifconfig.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/habitat/habitat_sup.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/habitat/habitat_sup_windows.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/inspec_waiver_file_entry.rb | 2 | ||||
-rw-r--r-- | lib/chef/secret_fetcher/azure_key_vault.rb | 2 |
7 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb index 6e4f13c291..8a616e5e07 100644 --- a/lib/chef/cookbook_version.rb +++ b/lib/chef/cookbook_version.rb @@ -598,7 +598,7 @@ class Chef filename = record[:name] base_dup_name = File.join(File.dirname(filename), File.basename(filename, File.extname(filename))) yml_files.each do |other| - if other[:name] =~ /#{(File.extname(filename) == ".yml") ? "#{base_dup_name}.yaml" : "#{base_dup_name}.yml"}$/ + if /#{(File.extname(filename) == ".yml") ? "#{base_dup_name}.yaml" : "#{base_dup_name}.yml"}$/.match?(other[:name]) raise Chef::Exceptions::AmbiguousYAMLFile.new("Cookbook #{name}@#{version} contains ambiguous files: #{filename} and #{other[:name]}. Please update the cookbook to remove the incorrect file.") end end diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb index 63aa126c2e..30fe4c2545 100644 --- a/lib/chef/provider/ifconfig.rb +++ b/lib/chef/provider/ifconfig.rb @@ -120,7 +120,7 @@ class Chef @status = shell_out("ifconfig") @status.stdout.each_line do |line| addr_regex = /^((\w|-)+):?(\d*):?\ .+$/ - if line =~ addr_regex + if line&.match?(addr_regex) if line.match(addr_regex).nil? @int_name = "nil" elsif line.match(addr_regex)[3] == "" diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 746efb5fd4..dadcb5c51a 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -1096,7 +1096,7 @@ class Chef rescue NameError => e # This can happen when attempting to load a provider in a platform-specific # environment where we have not required the necessary files yet - raise unless e.message =~ /uninitialized constant/ + raise unless /uninitialized constant/.match?(e.message) end # Define a method to load up this resource's properties with the current diff --git a/lib/chef/resource/habitat/habitat_sup.rb b/lib/chef/resource/habitat/habitat_sup.rb index 2fdfcd270f..b1cbe6cbed 100644 --- a/lib/chef/resource/habitat/habitat_sup.rb +++ b/lib/chef/resource/habitat/habitat_sup.rb @@ -284,7 +284,7 @@ class Chef if new_resource.peer peer_list = [] new_resource.peer.each do |p| - peer_list << if p !~ /.*:.*/ + peer_list << if !/.*:.*/.match?(p) p + ":9632" else p diff --git a/lib/chef/resource/habitat/habitat_sup_windows.rb b/lib/chef/resource/habitat/habitat_sup_windows.rb index c73e648f3c..1c574025d2 100644 --- a/lib/chef/resource/habitat/habitat_sup_windows.rb +++ b/lib/chef/resource/habitat/habitat_sup_windows.rb @@ -15,7 +15,7 @@ # limitations under the License. # -require "win32/service" if RUBY_PLATFORM =~ /mswin|mingw32|windows/ +require "win32/service" if RUBY_PLATFORM.match?(/mswin|mingw32|windows/) require_relative "habitat_sup" class Chef diff --git a/lib/chef/resource/inspec_waiver_file_entry.rb b/lib/chef/resource/inspec_waiver_file_entry.rb index 8b8a0b9415..2f3c806266 100644 --- a/lib/chef/resource/inspec_waiver_file_entry.rb +++ b/lib/chef/resource/inspec_waiver_file_entry.rb @@ -135,7 +135,7 @@ class Chef action_class do def load_waiver_file_to_hash(file_name) - if file_name =~ %r{(/|C:\\).*(.yaml|.yml)}i + if %r{(/|C:\\).*(.yaml|.yml)}i.match?(file_name) if ::File.exist?(file_name) hash = ::YAML.load_file(file_name) if hash == false || hash.nil? || hash == "" diff --git a/lib/chef/secret_fetcher/azure_key_vault.rb b/lib/chef/secret_fetcher/azure_key_vault.rb index d9acc7c3d0..c4bdd2b3ce 100644 --- a/lib/chef/secret_fetcher/azure_key_vault.rb +++ b/lib/chef/secret_fetcher/azure_key_vault.rb @@ -123,7 +123,7 @@ class Chef body["access_token"] when Net::HTTPBadRequest body = JSON.parse(response.body) - raise Chef::Exceptions::Secret::Azure::IdentityNotFound if body["error_description"] =~ /identity not found/i + raise Chef::Exceptions::Secret::Azure::IdentityNotFound if /identity not found/i.match?(body["error_description"]) else body = JSON.parse(response.body) body["access_token"] |