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-21 21:04:52 -0800
commit2c1b44f8fa632464fa129054a96cca232b501fd9 (patch)
tree5ab61a53c3e4cdebb60596062785acb316baec18
parent26f1f8273d3fff0cebe1e89a35f601e5747686b0 (diff)
downloadchef-URI_regex.tar.gz
Use URI::DEFAULT_PARSER.make_regexp instead of URI.regexpURI_regex
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}"