Bug 1458575

Summary: hammer csv content-views import fails when content view has not yet been published
Product: Red Hat Satellite Reporter: David Davis <daviddavis>
Component: Hammer - ContentAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.7CC: bbuckingham, daviddavis, jcallaha, pgervase, tbrisker, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:17 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 David Davis 2017-06-04 14:21:29 UTC
hammer_cli_csv-2.2.1.1

1. Create a content view (no repos necessary; do not publish)
2. Export content views (`hammer csv content-views --export --file /tmp/content_views.csv`)
3. Import the content views (`hammer csv content-views --file /tmp/content_views.csv)

Results:
NoMethodError (undefined method `each' for nil:NilClass):
/home/vagrant/hammer-cli-csv/lib/hammer_cli_csv/content_views.rb:155:in `promote_content_view'

Comment 4 Satellite Program 2017-06-06 18:17:53 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/19718 has been resolved.

Comment 5 jcallaha 2018-02-14 15:37:09 UTC
Verified in Satellite 6.3 Snap 35.

The import of an unpublished content view no longer fails.

Create a new content view.
Don't add anything to it, and do not publish.
Perform steps below.

-bash-4.2# hammer csv content-views --export --file /tmp/content_views.csv
-bash-4.2#

-bash-4.2# cat /tmp/content_views.csv 
Name,Label,Organization,Composite,Repositories or Composites,Lifecycle Environments
7capsule,7capsule,Default Organization,No,7 capsule,Library
rhel7,rhel7,Default Organization,No,"Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server,Red Hat Enterprise Linux 7 Server - Supplementary RPMs x86_64 7Server,Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64,Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.4,Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server,Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server,Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server",Library
rhel7partial,rhel7partial,Default Organization,No,"Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server,Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server",Library
unpublished,unpublished,Default Organization,No,"",""
7 capsule,7_capsule,Default Organization,Yes,"7capsule,rhel7partial",Library

 
-bash-4.2# hammer csv content-views -v --file /tmp/content_views.csv
Updating content view '7capsule'...done
Updating content view 'rhel7'...done
Updating content view 'rhel7partial'...done
Updating content view 'unpublished'...done
Updating content view '7 capsule'...done
-bash-4.2#

Comment 7 Satellite Program 2018-02-21 16:54:17 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-2018:0336