Bug 1645275

Summary: Output of "hammer organization list" Should Only Begin with an Organization ID
Product: Red Hat Satellite Reporter: William Allison <wallison>
Component: Organizations and LocationsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Peter Dragun <pdragun>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.3CC: apatel, dhlavacd, kgaikwad, mbacovsk, mhulan, mshira, oprazak, pcreech, pdragun, rabajaj
Target Milestone: 6.7.0Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-14 13:23:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description William Allison 2018-11-01 19:12:57 UTC
User-Agent:       Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Build Identifier: 

The output of the following commands should only print the Organization ID, one per line, of all Organizations on the Satellite Server:

hammer organization list | grep -vE '\--|ID' | awk '{ print $1 }'
hammer --csv organization list | grep -vi '^id' | awk -F, '{ print $1 }'

However, if there is a newline character in the "Description" field on the "Edit <Organization Name>" page available at Administer > Organizations > Primary, the text on the new line will show up in the "ID" field of the commands above.

Reproducible: Always

Steps to Reproduce:
1. Create an Organization with additional information on a new line in the Description field.
2. Login to the CLI of the Satellite Server as an admin user.
3. Run the commands included in this bug report.

Actual Results:  
The additional information from the Description field will be on a line by itself in the "ID" field.

Expected Results:  
Only numerical Organization IDs should be returned.

Additionally, there are two "Description" fields in the output of "hammer organization list".  This was observed on both Satellite versions 6.2.9 and 6.3.3.

Comment 2 Ondřej Pražák 2019-01-17 08:46:25 UTC
Created redmine issue http://projects.theforeman.org/issues/25878 from this bug

Comment 3 Bryan Kearney 2019-09-30 12:07:24 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25878 has been resolved.

Comment 4 Peter Dragun 2019-12-17 12:10:34 UTC
Verified on Satellite 6.7 snap 6.
New lines are now represented as white spaces. Also tried commands from comment 1. Output contains just IDs, each on its own line.

Comment 7 errata-xmlrpc 2020-04-14 13:23:25 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.