tomabg
April 19, 2020, 1:23pm
1
Hi,
have a question if it is possible to give a bool parameter with hammer?
hammer os update --id $CENTOS7OPID --os-parameters-attributes="[{“name”:“remote_execution_create_user”, “value”:true}]"
hammer os update --id $CENTOS7OPID --os-parameters-attributes="[{“name”:“remote_execution_create_user”, “value”:0}]"
I tried several methods but its always interpreted as a string…so how to archive this via command-line?
thanks
Thomas
Field parameter-type
added into parameters to support same types as smart class parameters. This change was introduced in Foreman 1.22 .
yes, it is possible with hammer. You can use either of the below sub-commands:
Using set-parameter
sub-command:
hammer os set-parameter --operatingsystem-id $CENTOS7OPID --name "remote_execution_create_user" --value true --parameter-type 'boolean'
Using os update
with --os-parameters-attributes
:
hammer os update --id $CENTOS7OPID --os-parameters-attributes "[{\"name\":\"remote_execution_create_user\", \"value\":true, \"parameter_type\":\"boolean\"}]"
1 Like
For option --os-parameters-attributes either you can send comma separated list of key-value or valid json string. Default value of parameter_type is string
so when you use below command:
hammer os update --id $CENTOS7OPID --os-parameters-attributes "name=remote_execution_create_user\\,value=true"
then it will create parameter but with type string.
1 Like
tomabg
April 20, 2020, 6:30pm
4
kgaikwad:
use below comm
many thanks for the info!
tomabg
April 20, 2020, 6:30pm
5
many thanks for the info!
tomabg
April 24, 2020, 5:54am
6
works great here the complete command only for INFO:
hammer os update --id $CENTOS7OPID --os-parameters-attributes="[{\"name\":\"remote_execution_create_user\", \"value\":true , \"parameter_type\":\"boolean\"}, \
{\"name\":\"remote_execution_ssh_user\", \"value\":\"$CENTOSREMOTEEXECUTIONUSER\"}, \
{\"name\":\"remote_execution_effective_user_method\", \"value\":\"sudo\"}, \
{\"name\":\"keyboard\", \"value\":\"$CENTOSKEYBOARD\"}, \
{\"name\":\"time-zone\", \"value\":\"$CENTOSTIMEZONE\"}]"
1 Like