summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorLamont Granquist <lamont@chef.io>2020-02-21 14:12:48 -0800
committerGitHub <noreply@github.com>2020-02-21 14:12:48 -0800
commit04979a3ba5ca32e3c97ae492eae84829994697a0 (patch)
tree1a6338a1616bdf1bad42877ca6db13ebe197a35a /lib/chef/provider
parentdb21135c646e2376206d73d364f2f7bac60c039d (diff)
parent1b02cfc8bcdb9569917eb954f2b59f686026cd9f (diff)
downloadchef-04979a3ba5ca32e3c97ae492eae84829994697a0.tar.gz
Merge pull request #9387 from chef/lcg/unescape
fix ruby 2.7 URI.unescape deprecation
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/package/cab.rb5
-rw-r--r--lib/chef/provider/package/msu.rb5
-rw-r--r--lib/chef/provider/package/windows.rb5
-rw-r--r--lib/chef/provider/remote_file/ftp.rb5
-rw-r--r--lib/chef/provider/remote_file/local_file.rb3
-rw-r--r--lib/chef/provider/remote_file/sftp.rb5
6 files changed, 17 insertions, 11 deletions
diff --git a/lib/chef/provider/package/cab.rb b/lib/chef/provider/package/cab.rb
index 9ccc373dd1..cce267879d 100644
--- a/lib/chef/provider/package/cab.rb
+++ b/lib/chef/provider/package/cab.rb
@@ -1,6 +1,6 @@
#
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@msystechnologies.com>)
-# Copyright:: Copyright 2015-2019, Chef Software Inc.
+# Copyright:: Copyright 2015-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@ require_relative "../../resource/cab_package"
require_relative "../../mixin/shell_out"
require_relative "../../mixin/uris"
require_relative "../../mixin/checksum"
+require "cgi" unless defined?(CGI)
class Chef
class Provider
@@ -58,7 +59,7 @@ class Chef
def default_download_cache_path
uri = ::URI.parse(new_resource.source)
- filename = ::File.basename(::URI.unescape(uri.path))
+ filename = ::File.basename(::CGI.unescape(uri.path))
file_cache_dir = Chef::FileCache.create_cache_path("package/")
Chef::Util::PathHelper.cleanpath("#{file_cache_dir}/#{filename}")
end
diff --git a/lib/chef/provider/package/msu.rb b/lib/chef/provider/package/msu.rb
index a00b3f3471..76ea89060d 100644
--- a/lib/chef/provider/package/msu.rb
+++ b/lib/chef/provider/package/msu.rb
@@ -1,6 +1,6 @@
#
# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
-# Copyright:: Copyright 2015-2016, Chef Software, Inc.
+# Copyright:: Copyright 2015-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,6 +27,7 @@ require_relative "cab"
require_relative "../../util/path_helper"
require_relative "../../mixin/uris"
require_relative "../../mixin/checksum"
+require "cgi" unless defined?(CGI)
class Chef
class Provider
@@ -99,7 +100,7 @@ class Chef
def default_download_cache_path
uri = ::URI.parse(new_resource.source)
- filename = ::File.basename(::URI.unescape(uri.path))
+ filename = ::File.basename(::CGI.unescape(uri.path))
file_cache_dir = Chef::FileCache.create_cache_path("package/")
Chef::Util::PathHelper.cleanpath("#{file_cache_dir}/#{filename}")
end
diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb
index d21c6576b6..3e0f2422cf 100644
--- a/lib/chef/provider/package/windows.rb
+++ b/lib/chef/provider/package/windows.rb
@@ -1,6 +1,6 @@
#
# Author:: Bryan McLellan <btm@loftninjas.org>
-# Copyright:: Copyright 2014-2018, Chef Software Inc.
+# Copyright:: Copyright 2014-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@ require_relative "../../resource/windows_package"
require_relative "../package"
require_relative "../../util/path_helper"
require_relative "../../mixin/checksum"
+require "cgi" unless defined?(CGI)
class Chef
class Provider
@@ -277,7 +278,7 @@ class Chef
def default_download_cache_path
uri = ::URI.parse(new_resource.source)
- filename = ::File.basename(::URI.unescape(uri.path))
+ filename = ::File.basename(::CGI.unescape(uri.path))
file_cache_dir = Chef::FileCache.create_cache_path("package/")
Chef::Util::PathHelper.cleanpath("#{file_cache_dir}/#{filename}")
end
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb
index eafebc9693..e2b32ddaf6 100644
--- a/lib/chef/provider/remote_file/ftp.rb
+++ b/lib/chef/provider/remote_file/ftp.rb
@@ -17,6 +17,7 @@
#
require "uri" unless defined?(URI)
+require "cgi" unless defined?(CGI)
require "tempfile" unless defined?(Tempfile)
require "net/ftp"
require_relative "../remote_file"
@@ -57,7 +58,7 @@ class Chef
def user
if uri.userinfo
- URI.unescape(uri.user)
+ CGI.unescape(uri.user)
else
"anonymous"
end
@@ -65,7 +66,7 @@ class Chef
def pass
if uri.userinfo
- URI.unescape(uri.password)
+ CGI.unescape(uri.password)
else
nil
end
diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb
index f76c475b1e..c68c4eecd5 100644
--- a/lib/chef/provider/remote_file/local_file.rb
+++ b/lib/chef/provider/remote_file/local_file.rb
@@ -17,6 +17,7 @@
#
require "uri" unless defined?(URI)
+require "cgi" unless defined?(CGI)
require "tempfile" unless defined?(Tempfile)
require_relative "../remote_file"
@@ -40,7 +41,7 @@ class Chef
def source_path
@source_path ||= begin
- path = URI.unescape(uri.path)
+ path = CGI.unescape(uri.path)
ChefUtils.windows? ? fix_windows_path(path) : path
end
end
diff --git a/lib/chef/provider/remote_file/sftp.rb b/lib/chef/provider/remote_file/sftp.rb
index 3da49ebedd..43654bd67c 100644
--- a/lib/chef/provider/remote_file/sftp.rb
+++ b/lib/chef/provider/remote_file/sftp.rb
@@ -17,6 +17,7 @@
#
require "uri" unless defined?(URI)
+require "cgi" unless defined?(CGI)
require "tempfile" unless defined?(Tempfile)
require "net/sftp"
require_relative "../remote_file"
@@ -47,7 +48,7 @@ class Chef
end
def user
- URI.unescape(uri.user)
+ CGI.unescape(uri.user)
end
def fetch
@@ -62,7 +63,7 @@ class Chef
end
def pass
- URI.unescape(uri.password)
+ CGI.unescape(uri.password)
end
def validate_path!