Bug 1492418

Summary: Download option for scap-content in CLI shows error undefined method `[]' for nil:NilClass
Product: Red Hat Satellite Reporter: Nikhil Kathole <nkathole>
Component: SCAP PluginAssignee: Ondřej Pražák <oprazak>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bbuckingham, ehelms, mhulan, oprazak
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman_openscap 0.7.8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:33:05 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 Nikhil Kathole 2017-09-17 09:42:11 UTC
Description of problem:


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


How reproducible:


Steps to Reproduce:
1. hammer scap-content list
---|------------------------------
ID | TITLE
---|------------------------------
14 | apple
2  | Red Hat jre default content
3  | Red Hat rhel6 default content
4  | Red Hat rhel7 default content
---|------------------------------
2. hammer scap-content --help
Usage:
    hammer scap-content [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:
 SUBCOMMAND                    subcommand
 [ARG] ...                     subcommand arguments

Subcommands:
 create                        Create SCAP content
 delete                        Deletes an SCAP content
 download                      Show an SCAP content as XML
 info                          Show an SCAP content
 list                          List SCAP contents
 update                        Update an SCAP content

Options:
 -h, --help                    print help
3. hammer scap-content download --help
Usage:
    hammer scap-content download [OPTIONS]

Options:
 --id ID
 --path PATH                   Path to directory where downloaded file will be saved
 --title TITLE                 SCAP content title
 -h, --help                    print help
4. hammer scap-content download --id=14 --path=/var
Could not download the SCAP content file:
  Error: undefined method `[]' for nil:NilClass


Actual results:
Could not able to download scap-content.

Expected results:
Scap-content should be downloaded.

Additional info:

Comment 1 Nikhil Kathole 2017-09-17 14:44:58 UTC
This is reproducible when scap-content is uploaded using CLI without providing --original-filename parameter.

# hammer scap-content create --title="abc" --scap-file=ssg-rhel7-ds.xml --organization-ids=1
SCAP content successfully created

# hammer scap-content download --title='abc' --path=/var
Could not download the SCAP content file:
  Error: found more than one scap_content

Comment 4 Ondřej Pražák 2017-09-27 11:57:53 UTC
Created redmine issue http://projects.theforeman.org/issues/21124 from this bug

Comment 5 Satellite Program 2017-09-27 14:17:33 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21124 has been resolved.

Comment 6 Nikhil Kathole 2017-10-03 09:19:37 UTC
VERIFIED

Version Tested:
Satellite-6.3 Snap 18

steps:

# hammer scap-content create --title="abc" --scap-file=ssg-rhel6-ds.xml --organization-ids=1
SCAP content successfully created

# hammer scap-content download --id=6 --path=/var
SCAP content file downloaded, saved to: /var/abc.xml

Comment 7 Bryan Kearney 2018-02-21 16:33:05 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