summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-21 21:04:52 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-27 14:46:44 -0800
commit7709ecb01695105e2eae7db925d345b86c9f7d00 (patch)
tree0188a0a1ca75d70e8898b0140183f788abe4d6a3
parentbb7d70c86d8af2d3acee51ea09e61ff638e1265f (diff)
downloadchef-7709ecb01695105e2eae7db925d345b86c9f7d00.tar.gz
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 <tsmith@chef.io>
-rw-r--r--lib/chef/application/base.rb2
-rw-r--r--lib/chef/knife/bootstrap/train_connector.rb2
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}"