Problema
A função split do Puppet falha desde que o Puppet foi atualizado para a versão 3.5.1
, enquanto isso funcionou até 3.4.3
Código
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 }
Resultado
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 ...
Pergunta
Como resolver esse problema?
Tags puppet