From 2c1b44f8fa632464fa129054a96cca232b501fd9 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sat, 21 Nov 2020 21:04:52 -0800 Subject: Use URI::DEFAULT_PARSER.make_regexp instead of URI.regexp RuboCop claims that URI.regexp is the obsolete way of doing this. Both produce the same regex. Signed-off-by: Tim Smith --- lib/chef/application/base.rb | 2 +- lib/chef/knife/bootstrap/train_connector.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chef/application/base.rb b/lib/chef/application/base.rb index 56e28baa79..ad8e8b69c2 100644 --- a/lib/chef/application/base.rb +++ b/lib/chef/application/base.rb @@ -366,7 +366,7 @@ class Chef::Application::Base < Chef::Application Chef::Log.trace("Download recipes tarball from #{url} to #{path}") if File.exist?(url) FileUtils.cp(url, path) - elsif URI.regexp.match?(url) + elsif URI::DEFAULT_PARSER.make_regexp.match?(url) File.open(path, "wb") do |f| open(url) do |r| f.write(r.read) diff --git a/lib/chef/knife/bootstrap/train_connector.rb b/lib/chef/knife/bootstrap/train_connector.rb index 8a1e5863bb..a220ece5bc 100644 --- a/lib/chef/knife/bootstrap/train_connector.rb +++ b/lib/chef/knife/bootstrap/train_connector.rb @@ -285,7 +285,7 @@ class Chef # Train.unpack_target_from_uri only works for complete URIs in # form of proto://[user[:pass]@]host[:port]/ # So we'll add the protocol prefix if it's not supplied. - uri_to_check = if URI.regexp.match(uri) + uri_to_check = if URI::DEFAULT_PARSER.make_regexp.match(uri) uri else "#{default_protocol}://#{uri}" -- cgit v1.2.1