Replace URI.escape() with ERB::Util.url_encode()
URI.escape() method has been removed in ruby 3 and the newly added Puppet::Util.rfc2396_escape()[1] has not been released yet. [1]41dcae71c7Closes-Bug: #1928685 Change-Id: I001d579a1b126fc8254f071ddbecda5cc6de7231 (cherry picked from commit0699227b3c)
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| Puppet::Functions.create_function(:os_database_connection) do | ||||
|   def os_database_connection(*args) | ||||
|     require 'uri' | ||||
|     require 'erb' | ||||
|  | ||||
|     if (args.size != 1) then | ||||
|       raise(Puppet::ParseError, "os_database_connection(): Wrong number of arguments " + | ||||
| @@ -44,9 +44,9 @@ Puppet::Functions.create_function(:os_database_connection) do | ||||
|     end | ||||
|  | ||||
|     if v.include?('username') and (v['username'] != :undef) and (v['username'].to_s != '') | ||||
|       parts[:userinfo] = URI.escape(v['username']) | ||||
|       parts[:userinfo] = ERB::Util.url_encode(v['username']) | ||||
|       if v.include?('password') and (v['password'] != :undef) and (v['password'].to_s != '') | ||||
|         parts[:userinfo] += ":#{URI.escape(v['password'])}" | ||||
|         parts[:userinfo] += ":#{ERB::Util.url_encode(v['password'])}" | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
| @@ -80,7 +80,7 @@ Puppet::Functions.create_function(:os_transport_url) do | ||||
|   end | ||||
|  | ||||
|   def os_transport_url(*args) | ||||
|     require 'uri' | ||||
|     require 'erb' | ||||
|  | ||||
|     unless args.size == 1 | ||||
|       raise(ArgumentError, 'os_transport_url(): Wrong number of arguments') | ||||
| @@ -130,9 +130,9 @@ Puppet::Functions.create_function(:os_transport_url) do | ||||
|     parts[:transport] = v['transport'] | ||||
|  | ||||
|     if v.include?('username') and (v['username'] != :undef) and (v['username'].to_s != '') | ||||
|       parts[:userinfo] = URI.escape(v['username']) | ||||
|       parts[:userinfo] = ERB::Util.url_encode(v['username']) | ||||
|       if v.include?('password') and (v['password'] != :undef) and (v['password'].to_s != '') | ||||
|         parts[:userinfo] += ":#{URI.escape(v['password'])}" | ||||
|         parts[:userinfo] += ":#{ERB::Util.url_encode(v['password'])}" | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ramishra
					ramishra