Bug 1140393

Summary: Cant specify comma spaced lists as values to the --parameters option.
Product: Red Hat OpenStack Reporter: joherr
Component: rubygem-hammer_cli_foremanAssignee: Martin Bacovsky <mbacovsk>
Status: CLOSED EOL QA Contact: Omri Hochman <ohochman>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: Foreman (RHEL 6)CC: mburns, rhos-maint, srevivo
Target Milestone: ---Keywords: ZStream
Target Release: Installer   
Hardware: Unspecified   
OS: Linux   
URL: http://projects.theforeman.org/issues/7433
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1141671 (view as bug list) Environment:
Last Closed: 2016-09-29 13:43:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1141671    
Bug Blocks:    

Description joherr 2014-09-10 20:36:09 UTC
Description of problem:

A comma seperated list cannot be passed as a value in a key/value pair when using the --parameters option when creating a host.


Version-Release number of selected component (if applicable):
# hammer --version
hammer (0.1.0)
 * hammer_cli_foreman (0.1.0)


How reproducible:
Always

Steps to Reproduce:
1.Create a host and specify the --parameters option with a comma seperated list as a value in a keypair.

2. hammer host create --name "test.example.org" --build true --enabled true --managed true --environment-id 1 --ip "192.168.10.10" --mac "02:00:00:00:00:b0" --subnet-id 1 --architecture-id 1 --medium-id 8 --partition-table-id 11 --root-password changeme --parameters subscription_manager=true,subscription_manager_username=smuser,subscription_manager_password=smpass,subscription_manager_repos="rhel-server-rhscl-6-rpms, rhel-6-server-rpms, rhel-6-server-openstack-5.0-rpms",subscription_manager_pool=34gf434gf34f34f4442

3.

Actual results:
Could not create the host:
  Error: option '--parameters': value must be defined as a comma-separated list of key=value
  
  See: 'hammer host create --help'


Expected results:
Expect the host to be created with appropriate parameters


Additional info:

I am using the --parameters option to the "hammer host create" or "hammer
host update" commands. This option takes a comma seperated list of
key=value pairs. The issue I am running into is I need to specify a comma seperated list as a value.

The above command fails telling me I must specify a comma seperated list
of key/values:

I can specify the same command without the subscription_manager_repos="..." key/value pair and it works fine. If I specify only the subscription_manager_repos="..." key and value, it fails.

I suspect the hammer code is splitting the command at all commas and ignoring any quotes that indicate grouping.

Comment 4 Martin Bacovsky 2014-09-15 12:50:43 UTC
Fix for this issue is included in rubygem-hammer-cli-0.1.3. The PR is
https://github.com/theforeman/hammer-cli/pull/137.

With the patch applied the format of the correct command would be (the list needs to be enclosed in the square brackets, no spaces):

hammer host create --name "test.example.org" --build true --enabled true --managed true --environment-id 1 --ip "192.168.10.10" --mac "02:00:00:00:00:b0" --subnet-id 1 --architecture-id 1 --medium-id 8 --partition-table-id 11 --root-password changeme --parameters "subscription_manager=true,subscription_manager_username=smuser,subscription_manager_password=smpass,subscription_manager_repos=[rhel-server-rhscl-6-rpms,rhel-6-server-rpms,rhel-6-server-openstack-5.0-rpms],subscription_manager_pool=34gf434gf34f34f4442"

Comment 6 Mike McCune 2016-03-28 23:02:11 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 7 Jaromir Coufal 2016-09-29 13:43:38 UTC
Closing list of bugs for RHEL OSP Installer since its support cycle has already ended [0]. If there is some bug closed by mistake, feel free to re-open.

For new deployments, please, use RHOSP director (starting with version 7).

-- Jaromir Coufal
-- Sr. Product Manager
-- Red Hat OpenStack Platform

[0] https://access.redhat.com/support/policy/updates/openstack/platform