Skip to content

Commit 968480c

Browse files
committed
deprecate join()
1 parent f20d495 commit 968480c

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,8 @@ Returns `true` if the variable passed to this function is a string.
16351635

16361636
#### `join`
16371637

1638+
**Deprecated. Puppet 5.5.0 has introduced an inbuilt `join` function, that will take precedence over the stdlib function. See [Puppet 5.5.0 Release Notes](https://puppet.com/docs/puppet/5.5/release_notes.html#new-features).**
1639+
16381640
Joins an array into a string using a separator. For example, `join(['a','b','c'], ",")` results in: "a,b,c".
16391641

16401642
*Type*: rvalue.

lib/puppet/parser/functions/join.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ module Puppet::Parser::Functions
1313
DOC
1414
) do |arguments|
1515

16+
function_deprecation([:join, 'This method is deprecated, this function is now shipped in puppet in versions 5.5.0 and later.
17+
For more information please see [puppet 5.5.0 release notes|https://puppet.com/docs/puppet/5.5/release_notes.html#new-features].'])
18+
1619
# Technically we support two arguments but only first is mandatory ...
1720
raise(Puppet::ParseError, "join(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
1821

spec/functions/join_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
describe 'join' do
44
it { is_expected.not_to eq(nil) }
5-
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
5+
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } if Puppet.version < '5.5.0'
66
it {
77
pending('Current implementation ignores parameters after the second.')
88
is_expected.to run.with_params([], '', '').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i)
99
}
10-
it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, %r{Requires array to work with}) }
11-
it { is_expected.to run.with_params([], 2).and_raise_error(Puppet::ParseError, %r{Requires string to work with}) }
10+
it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, %r{Requires array to work with}) } if Puppet.version < '5.5.0'
11+
it { is_expected.to run.with_params([], 2).and_raise_error(Puppet::ParseError, %r{Requires string to work with}) } if Puppet.version < '5.5.0'
1212

1313
it { is_expected.to run.with_params([]).and_return('') }
1414
it { is_expected.to run.with_params([], ':').and_return('') }

0 commit comments

Comments
 (0)