Bug 1425434

Summary: Unable to hammer csv import products : 422 Unprocessable Entity
Product: Red Hat Satellite Reporter: Francisco Garcia <fgarciad>
Component: Hammer - ContentAssignee: Tom McKay <tomckay>
Status: CLOSED ERRATA QA Contact: Amir <afeferku>
Severity: medium Docs Contact:
Priority: high    
Version: 6.2.7CC: afeferku, bbuckingham, bkearney, dcaplan, dhlavacd, inpro.base, jcallaha, mhulan, tbhowmik, tomckay, tstrachota
Target Milestone: UnspecifiedKeywords: PrioBumpPM, 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:51:07 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-21 12:28:23 UTC
Description of problem:

I'm trying to import the 'products' CSV generated in one Satellite instance in a new Satellite instance with the same Organization name, and get a "422 Unprocesable Entity" when restoring a product that uses Red Hat CDN repositories.

Digging a bit deeper, it seems that hammer csv is not able to cope with repositories that do not have tagged releasever information (eg: RHEL Extras, Satellite, Cloudforms, others).


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

Satellite 627
tfm-rubygem-hammer_cli_csv-2.2.1.1-1.el7sat.noarch


How reproducible:


Have a CSV that refers to Products without a releasever field and try to import them:

# 

# hammer csv products --no-sync < products.csv 
Error: 422 Unprocessable Entity
Red Hat Satellite Capsule,Red_Hat_Satellite_Capsule,MyOrg,,Red Hat Satellite Capsule 6.2 for RHEL 7 Server RPMs x86_64,Red Hat Yum,Red Hat Satellite Capsule 6.2 (for RHEL 7 Server) (RPMs),,https://cdn.redhat.com/
content/dist/rhel/server/7/7Server/x86_64/sat-capsule/6.2/os,No,No,No,immediate,,

The following message can be found in /var/log/foreman/production.log :

2017-02-21 06:46:54 [app] [E] Katello::Errors::CdnSubstitutionError: ["releasever"] cannot be specified for Red Hat Satellite Capsule 6.2 (for RHEL 7 Server) (RPMs) as that information is not substituable in /content/dist/rhel/server/7/7Server/$basearch/sat-capsule/6.2/os


# grep Satellite products.csv
Red Hat Satellite Capsule,Red_Hat_Satellite_Capsule,MyOrg,,Red Hat Satellite Capsule 6.2 for RHEL 7 Server RPMs x86_64,Red Hat Yum,Red Hat Satellite Capsule 6.2 (for RHEL 7 Server) (RPMs),,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-capsule/6.2/os,No,No,No,immediate,,
Red Hat Satellite Capsule,Red_Hat_Satellite_Capsule,MyOrg,,Red Hat Satellite Capsule 6.1 for RHEL 7 Server RPMs x86_64,Red Hat Yum,Red Hat Satellite Capsule 6.1 (for RHEL 7 Server) (RPMs),,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-capsule/6.1/os,No,No,No,immediate,,
Red Hat Satellite,Red_Hat_Satellite,MyOrg,,Red Hat Satellite 6.2 for RHEL 7 Server RPMs x86_64,Red Hat Yum,Red Hat Satellite 6.2 (for RHEL 7 Server) (RPMs),,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/satellite/6.2/os,No,No,No,immediate,,
Red Hat Satellite,Red_Hat_Satellite,MyOrg,,Red Hat Satellite 6.1 for RHEL 7 Server RPMs x86_64,Red Hat Yum,Red Hat Satellite 6.1 (for RHEL 7 Server) (RPMs),,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/satellite/6.1/os,No,No,No,immediate,,
Red Hat Enterprise Linux Server,Red_Hat_Enterprise_Linux_Server,MyOrg,,Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64,Red Hat Yum,Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs),,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-tools/6.2/os,No,No,No,immediate,,
Red Hat Enterprise Linux Server,Red_Hat_Enterprise_Linux_Server,MyOrg,,Red Hat Satellite Tools 6.1 for RHEL 7 Server RPMs x86_64,Red Hat Yum,Red Hat Satellite Tools 6.1 (for RHEL 7 Server) (RPMs),,https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-tools/6.1/os,No,No,No,immediate,,

Comment 3 Tom McKay 2017-02-21 19:04:26 UTC
Created redmine issue http://projects.theforeman.org/issues/18616 from this bug

Comment 7 Satellite Program 2017-05-30 16:19:00 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18616 has been resolved.

Comment 8 Satellite Program 2017-06-01 20:29:54 UTC
1439850

Comment 9 Amir 2017-08-23 08:49:37 UTC
Verified.
Version Tested: Satellite-6.3 Snap 12 
performed the following steps to verify this issue:
 1. hammer csv products --export > /tmp/products.csv
 2. edited products.csv, with empty realaseserver field
 3. hammer csv products --no-sync </tmp/products.csv 
 Verified no errors appeared and that a new product has been

Comment 10 Satellite Program 2018-02-21 16:51:07 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