Bug 1492832

Summary: Hammer CLI has not option to list repository content
Product: Red Hat Satellite Reporter: Renzo Nuccitelli <rnuccite>
Component: RepositoriesAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Renzo Nuccitelli <rnuccite>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: akofink, bbuckingham, dhlavacd, ehelms, sghai, tstrachota, zhunting
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 17:00:37 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:

Description Renzo Nuccitelli 2017-09-18 17:21:56 UTC
Description of problem:

Missing feature on Support Arbitrary Files within Content Views.

Hammer has 2 commands to respective add and remove fiels to/from a Repository of type file:

1) hammer repository upload-content
2) hammer repository remove-content

For the second one there is a parameter called "ids" where a list of ids of content to be removed can be provided. Besides that there is no way to query a repository for its contents.
The command "hammer repository --id=repo_id" returns no content and has no option to include these data. Thus the user can not rely entirely on CLI to automate tasks.

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

Satellite 6.3 snap 15.

How reproducible:


Steps to Reproduce:
1. Create a product
2. Attach a repository of type file to it
3. Upload a file to repository
4. Run command hammer repository --id=repo_id

Actual results:

No way of access repository content data, specifically their ids. 

Expected results:

A way of access repository content data.

Additional info:

On API doc at path /api/v2 there is also no documented endpoint to access repository content data. Besides that content can be queried on api/v2/files?repository_id=query_id.

Comment 2 Brad Buckingham 2017-09-27 17:03:28 UTC
Created redmine issue http://projects.theforeman.org/issues/21142 from this bug

Comment 3 Satellite Program 2017-10-06 18:22:55 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21142 has been resolved.

Comment 4 Renzo Nuccitelli 2017-10-16 14:46:06 UTC
I've read the PR but were not able to realize what command should I use to get file content. I've tried the info but still it has no info about the content:

hammer> repository info --id=1
ID:                 1
Name:               file-repo
Label:              file-repo
Organization:       Default Organization
Red Hat Repository: no
Content Type:       file
Mirror on Sync:     yes
Publish Via HTTP:   yes
Published At:       http://some.sat.host/isos/919c22dc-a130-4b01-a256-d2825978d1d4/
Relative Path:      Default_Organization/Library/custom/file-product/file-repo
Download Policy:    
    ID:   1
    Name: file-product
GPG Key:            

    Status: Not Synced
Created:            2017/10/16 14:33:25
Updated:            2017/10/16 14:33:28
Content Counts:

I have also ran hammer repository --help to check if a new command was added, but there is no new command. So could an example of how to use this command be provided?

Comment 5 Andrew Kofink 2017-10-16 15:46:19 UTC
$ hammer file list --repository-id 5
ID | NAME           | PATH          
5  | bar.txt        | bar.txt       
1  | NCC-170115.xml | NCC-170115.xml

Comment 6 Renzo Nuccitelli 2017-10-17 17:02:45 UTC
The command is not available on last sat 6.3 release:

[root@ ~]# rpm -q satellite
[root@ ~]# hammer file
Error: No such sub-command 'file'

Is it possible that we didn't cherry pick this change to last compose?

Comment 7 Andrew Kofink 2017-10-17 17:08:27 UTC
The hammer component didn't make it into snap 20. I'm moving it to MODIFIED so it can make it into the next snap.

Comment 8 Renzo Nuccitelli 2017-10-25 12:13:14 UTC
Command worked on satellite 6.3.0 snap 21:

hammer> file list --repository-id 4
ID | NAME                  | PATH                 
1  | zoo_custom_gpgkey.txt | zoo_custom_gpgkey.txt

Moving this BZ to verified

Comment 9 Bryan Kearney 2018-02-21 17:00:37 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.