You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: Well, only saw the PR after submitting. This issue is fixed by #576
While testing v7.2.0 I noticed Puppet runs failing due to Evaluation Error: Unknown variable: '_sort_options_alphabetic'.
Info: Using environment 'haproxy_v7_2_0'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown variable: '_sort_options_alphabetic'. (file: /etc/puppetlabs/code/environments/haproxy_v7_2_0/modules/haproxy/manifests/backend.pp, line: 132, column: 35) on node some-server.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
With conversion of *.erb to *.epp templates $_sort_options_alphabetic is now given as template parameter:
This surfaces a bug in the variables assignment logic: in case $options is a Hash, but the key optiondoes not contain httpchk$_sort_options_alphabetic stays undefined (e.g. when using tcp-check instead).
...
if $options.is_a(Hash) and 'option' in $options {
if ('httpchk' in $options['option']) {
warning('Overriding the value of $sort_options_alphabetic to "false" due to "httpchk" option defined')
$_sort_options_alphabetic = false
}
} else {
...
}
...
This wasn't an issue before, because the variable was only evaluated in the *.erb template. It was effectively treated as false.
There are multiple options to resolve this: (1) adding or ('tcp-check' in $options['option']) to the condition, (2) adding an else or elsif, (3) adding pick($_sort_options_alphabetic, false) to the parameters hash, or ... some less minimal options like refactoring the assignment and others I didn't think of.
On a side note: pick() is either redundant on line 108 or the stdlib's description of pick() isn't (fully) correct
The defined type's parameter $sort_options_alphabetic is Boolean. There is/seems to be no way this parameter could be undef or '' without failing the data type.
The text was updated successfully, but these errors were encountered:
EDIT: Well, only saw the PR after submitting. This issue is fixed by #576
While testing
v7.2.0
I noticed Puppet runs failing due toEvaluation Error: Unknown variable: '_sort_options_alphabetic'.
With conversion of
*.erb
to*.epp
templates$_sort_options_alphabetic
is now given as template parameter:This surfaces a bug in the variables assignment logic: in case
$options
is a Hash, but the keyoption
does not containhttpchk
$_sort_options_alphabetic
stays undefined (e.g. when usingtcp-check
instead).This wasn't an issue before, because the variable was only evaluated in the
*.erb
template. It was effectively treated asfalse
.There are multiple options to resolve this: (1) adding
or ('tcp-check' in $options['option'])
to the condition, (2) adding anelse
orelsif
, (3) addingpick($_sort_options_alphabetic, false)
to the parameters hash, or ... some less minimal options like refactoring the assignment and others I didn't think of.On a side note:
pick()
is either redundant on line 108 or the stdlib's description ofpick()
isn't (fully) correctpick()
returns "... the first value in a list of values that is not undefined or an empty string."$sort_options_alphabetic
is Boolean. There is/seems to be no way this parameter could beundef
or''
without failing the data type.The text was updated successfully, but these errors were encountered: