Foreman hammer-cli smart-class-parameter fails to set false on Bool

Problem:
When using foreman1.16/puppet5 I have hit an issue around BOOL type.

I didnt get using foreman1.15/puppet3

if a class has a default value = true

class myclass::client (
$client = true
){
notify{“myclass $class”:}
}

hammer -sc-param add-override-value --puppet-class myclass::client --smart-class-parameter-id 1–value “true” --match hostgroup=my_network/myclass

hammer -sc-param add-override-value --puppet-class myclass::client --smart-class-parameter-id 1–value “false” --match hostgroup=my_network/myclass

The second one fails with Bool. This worked on earlier versions of puppet and hammer/foreman should not be data-typing input in this way on variables that are not cast as Boolean. it is making a guest based on the default value. if this is true it is assuming bool!

old versions didnt do this and the field type reminded string.

When setting
Expected outcome:
for default value to be changed to that given. if bool then to allow “false” or false or 0 or undef at least something that sets none true.

Foreman and Proxy versions:
1.16
Foreman and Proxy plugin versions:
as above
Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]

This is an easy one to replicate in a test. set the default value of a var to true and then try and override this with false. 1.16 it fails. 1.15 it didnt.

I am adding this to assist anyone else who finds that a Value set to
Boolean ends up as a string.

You have to fish out the following to elements
puppet-class-id & sc-param id

hammer sc-param update --id 1711 --puppet-class-id 303 --parameter-type boolean --override true --default-value false

1 Like