2

Problem

Puppet split function fails since Puppet has been upgraded puppet to version 3.5.1, while this worked until 3.4.3

Code

 1  $ports_regex = "80\\|443"
 2
 3  $ports_string       = regsubst($ports_regex, '\\\|', ',', 'G')
 4
 5  notify{"CP1 ${ports_string}":}
 6
 7  $ports_array = split($ports_string, ',')
 8
 9  notify{"CP2 ${ports_array}":}
10
11  each($ports_array) |$port| {
12      notify{"CP3 ${port}":}
13
14      file {"${port}":
15          path => "c:/temp/puppettest/${port}",
16          ensure => present;
17      }
18  }

Outcome

3.4.3

Notice: /Stage[main]/Main/File[443]/ensure: created
Notice: CP2 80443
Notice: /Stage[main]/Main/Notify[CP2 80443]/message: defined 'message' as 'CP2 80443'
Notice: CP1 80,443
Notice: /Stage[main]/Main/Notify[CP1 80,443]/message: defined 'message' as 'CP1 80,443'
Notice: CP3 80
Notice: /Stage[main]/Main/Notify[CP3 80]/message: defined 'message' as 'CP3 80'
Notice: /Stage[main]/Main/File[80]/ensure: created
Notice: CP3 443
Notice: /Stage[main]/Main/Notify[CP3 443]/message: defined 'message' as 'CP3 443'

3.5.1

C:\Windows\system32>puppet apply --parser future --debug --verbose "C:\temp\puppettest\site.pp"
Error: Invalid tag cp2  at C:/temp/puppettest/site.pp:9 on node ...
Error: Invalid tag cp2  at C:/temp/puppettest/site.pp:9 on node ...

Question

How to solve this issue?

  • Can we get some line numbers here? What exactly is on line 9 of your site.pp? Is line 9 the split() call? – Zoredache Apr 30 '14 at 22:48
  • I have added line numbers as well – 030 May 1 '14 at 6:46
  • It may be a regression in the future parser. You may wish to bring this up with the dev team. – Felix Frank May 5 '14 at 16:29
  • It seems that the split function neither works in 3.5.1, nor in 3.6.0. An issue has been created at Puppet Labs. – 030 May 18 '14 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.