Red Hat Bugzilla – Bug 1201364
Arrays in key-value parameters can't contain spaces
Last modified: 2016-07-27 07:23:24 EDT
Arrays in key-value parameters currently can't contain spaces which is a bit unintuitive. Parsing of the following: <pre> hammer host create --parameters packages='[vim, tmux]' </pre> results in: <pre> {"packages"=>["vim", " tmux"]} </pre> Note the additional leading space in tmux. Also <pre> hammer host create --parameters formula='a=b+1' </pre> gets parsed wrongly as: <pre> {"formula=a"=>"b+1"} </pre> but it's a minor issue.
Created from redmine issue http://projects.theforeman.org/issues/9721
Moving to POST since upstream bug http://projects.theforeman.org/issues/9721 has been closed ------------- Anonymous Applied in changeset commit:8df57d3ecc1fb96433b90b9ee94a160b5069481c.
Failed on: Satellite-6.1.0-RHEL-7-20150406.0 Steps: 1. Created dependent entities 2. Tried to create a host passing the parameters: `--parameters "packages=[vim, tmux]"` # LANG=en_US.UTF-8 hammer -v -u admin -p changeme --output=csv host create --medium-id="39" --root-pass="password" --mac="83:4d:ed:00:b8:7d" --organization-id="266" --location-id="265" --architecture-id="36" --operatingsystem-id="44" --name="host1" --environment-id="97" --domain-id="36" --puppet-proxy-id="1" --partition-table-id="33" --parameters "packages=[vim, tmux]" [ERROR 2015-04-06 16:00:24 Exception] undefined method `strip!' for ["vim", "tmux"]:Array Could not create the host: undefined method `strip!' for ["vim", "tmux"]:Array [ERROR 2015-04-06 16:00:24 Exception] RestClient::InternalServerError (500 Internal Server Error): /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!' /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result' /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit' /usr/share/ruby/net/http.rb:852:in `start' /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit' /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute' /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute' /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:67:in `post' /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:279:in `call_client' /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:210:in `http_call' /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:160:in `call' /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/resource.rb:14:in `call' /usr/share/gems/gems/hammer_cli-0.1.4.8/lib/hammer_cli/apipie/command.rb:43:in `send_request' /usr/share/gems/gems/hammer_cli_foreman-0.1.4.7/lib/hammer_cli_foreman/commands.rb:179:in `send_request' /usr/share/gems/gems/hammer_cli-0.1.4.8/lib/hammer_cli/apipie/command.rb:34:in `execute' /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/share/gems/gems/hammer_cli-0.1.4.8/lib/hammer_cli/abstract.rb:23:in `run' /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/share/gems/gems/hammer_cli-0.1.4.8/lib/hammer_cli/abstract.rb:23:in `run' /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/share/gems/gems/hammer_cli-0.1.4.8/lib/hammer_cli/abstract.rb:23:in `run' /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/share/gems/gems/hammer_cli-0.1.4.8/bin/hammer:108:in `<top (required)>' /usr/bin/hammer:23:in `load' /usr/bin/hammer:23:in `<main>'
There's another issue that prevents from setting parameters on hosts: http://projects.theforeman.org/issues/10547 Upstream patch created and ready for review.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2015:1592
Accidentally closed with 6.1.1 errata
Verified. Version Tested: satellite-6.2.0-14.2.el7sat.noarch Both problems are solved, I can create packages='[vim, tmux]' and formula='a=b+1' parameters, in the first case the space is omitted, in second case the equalsign is part of the value. Additional information: tfm-rubygem-hammer_cli-0.5.1.10-1.el7sat.noarch tfm-rubygem-hammer_cli_foreman_remote_execution-0.0.5.3-1.el7sat.noarch tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.2-1.el7sat.noarch tfm-rubygem-hammer_cli_foreman_tasks-0.0.10.2-1.el7sat.noarch tfm-rubygem-hammer_cli_katello-0.0.22.13-2.el7sat.noarch tfm-rubygem-hammer_cli_foreman_docker-0.0.5-1.el7sat.noarch tfm-rubygem-hammer_cli_csv-2.0.0.1-1.el7sat.noarch tfm-rubygem-hammer_cli_import-0.10.23-1.el7sat.noarch tfm-rubygem-hammer_cli_foreman-0.5.1.8-1.el7sat.noarch tfm-rubygem-hammer_cli_foreman_discovery-0.0.2.2-1.el7sat.noarch
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1501