Bug 1427456

Summary: Hammer csv content-views fails to export/import Composite Content Views
Product: Red Hat Satellite Reporter: Francisco Garcia <fgarciad>
Component: Hammer - ContentAssignee: Tom McKay <tomckay>
Status: CLOSED WONTFIX QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.7CC: bbuckingham, bkearney, ehelms, jcallaha, tomckay
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hammer-cli-csv-2.3.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-03 18:03: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:

Description Francisco Garcia 2017-02-28 09:24:53 UTC
Description of problem:

Hi,

I'm exporting/importing Composite content views from a Satellite system to a new Satellite system and the import process of composite content views generates a extraneous column: 

$ cat content_views.csv
Name,Label,Organization,Composite,Repositories or Composites,Lifecycle Environments
...
WAF,1,WAF,MyOrg,Yes,"CV_RHEL72,CV_SECURITY,CV_BASE","Library,Production,QA"


The second column ("1") should not be there, as it shifts the columns and the import process fails with "WAF is not a valid organization".


Version-Release number of selected component (if applicable):

Satellite 6.2.7
tfm-rubygem-hammer_cli-0.5.1.12-1.el7sat.noarch
tfm-rubygem-hammer_cli_csv-2.2.1.1-1.el7sat.noarch


How reproducible:
Always


Steps to Reproduce:
1. hammer csv content-views > cv.csv
2. hammer csv content-views --continue-on-errors --file cv.csv

Comment 1 Francisco Garcia 2017-02-28 09:38:04 UTC
The actual error message when importing an incorrectly-formatted CSV: 

Error: Organization 'WAF' not found
WAF,1,WAF,MyOrg,Yes,"CV_RHEL72,CV_SECURITY,CV_BASE","Library,Production,QA"

Comment 2 Tom McKay 2017-02-28 14:20:42 UTC
Created redmine issue http://projects.theforeman.org/issues/18723 from this bug

Comment 4 Francisco Garcia 2017-03-02 14:12:44 UTC
Apologies, this is a duplicate of upstream bug #18344, which is now resolved. Upstream bug (18723) opened for this BZ can be closed/marked as duplicate of 18344.

Comment 5 Bryan Kearney 2017-03-22 20:31:03 UTC
Removing the dupe upstream issue.

Comment 6 Satellite Program 2017-03-22 22:13:50 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18344 has been resolved.

Comment 8 Tomas Strachota 2017-08-23 11:56:32 UTC
Failed. 
Version Tested: Satellite-6.3 Snap 12


This was fixed only partially. The extra '1' was removed from csv output but content view import/export still doesn't work correctly. The "Repositories or Composites" column is always blank for composite CVs, which prevents from importing it correctly.

Having "CV A" and "CV B" that are components of "CV Composite":

> hammer csv content-views --export > ./content_views.csv
> cat ./content_views.csv
Name,Label,Organization,Composite,Repositories or Composites,Lifecycle Environments
CV A,CV_A,Default Organization,No,"",""
CV B,CV_B,Default Organization,No,"",""
CV Composite,CV_Composite,Default Organization,Yes,"",""

Then I attempted to import the CVs into a fresh satellite installation:

> hammer csv content-views --file ./content_views.csv

The process finishes successfully but "CV Composite" doesn't have the original components assigned.

Comment 11 Bryan Kearney 2020-02-03 18:03:38 UTC
Hammer csv is no longer supported.