Bug 1201364 - Arrays in key-value parameters can't contain spaces
Summary: Arrays in key-value parameters can't contain spaces
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Tomas Strachota
QA Contact: Marek Hulan
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On: 1272979
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-12 14:44 UTC by Tomas Strachota
Modified: 2019-09-26 15:42 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:23:24 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 9721 0 None None None 2016-04-22 17:00:38 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description Tomas Strachota 2015-03-12 14:44:09 UTC
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.

Comment 1 Tomas Strachota 2015-03-12 14:44:10 UTC
Created from redmine issue http://projects.theforeman.org/issues/9721

Comment 3 Bryan Kearney 2015-03-17 16:05:43 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9721 has been closed
-------------
Anonymous
Applied in changeset commit:8df57d3ecc1fb96433b90b9ee94a160b5069481c.

Comment 6 Elyézer Rezende 2015-04-06 20:01:34 UTC
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>'

Comment 7 Tomas Strachota 2015-05-19 12:28:57 UTC
There's another issue that prevents from setting parameters on hosts:
http://projects.theforeman.org/issues/10547

Upstream patch created and ready for review.

Comment 9 errata-xmlrpc 2015-08-12 05:29:53 UTC
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

Comment 10 sthirugn@redhat.com 2015-08-14 20:47:51 UTC
Accidentally closed with 6.1.1 errata

Comment 12 Marek Hulan 2016-06-06 14:10:22 UTC
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

Comment 13 Bryan Kearney 2016-07-27 11:23:24 UTC
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


Note You need to log in before you can comment on or make changes to this bug.