Skip to content

Commit 799d608

Browse files
committed
(CONT-801) Deprecate uriescape.rb
1 parent c0c7ccb commit 799d608

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/puppet/parser/functions/uriescape.rb

+5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ module Puppet::Parser::Functions
1515
@return [String]
1616
a string that contains the converted value
1717
18+
> **Note:** **Deprecated:** Starting Puppet 8, our Ruby version has upgraded to 3.2.
19+
Therefore, its no longer possible to call URI.escape as it was deprecated by 2.7 and removed completely by 3+.
20+
This function should be removed once Puppet 7 is no longer supported.
1821
DOC
1922
) do |arguments|
23+
raise(Puppet::ParseError, 'Puppet: This function is not available in Puppet 8. URI.escape no longer exists as of Ruby 3+.') if Puppet::Util::Package.versioncmp(Puppet.version, '8').positive?
24+
2025
raise(Puppet::ParseError, "uriescape(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
2126

2227
value = arguments[0]

spec/functions/uriescape_spec.rb

+4
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,9 @@
3939
it { is_expected.to run.with_params(['one}', 'two']).and_return(['one%7D', 'two']) }
4040
it { is_expected.to run.with_params(['one}', 1, true, {}, 'two']).and_return(['one%7D', 1, true, {}, 'two']) }
4141
end
42+
else
43+
describe 'raising errors in Puppet 8' do
44+
it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{This function is not available in Puppet 8. URI.escape no longer exists as of Ruby 3+.}) }
45+
end
4246
end
4347
end

0 commit comments

Comments
 (0)