Bug 1265686

Summary: hammer content-view remove-version confusing with versions subcommand
Product: Red Hat Satellite Reporter: Peter Vreman <peter.vreman>
Component: HammerAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.2CC: bbuckingham, cwelton, ehelms, jcallaha, mmccune
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:27:35 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:
Bug Depends On:    
Bug Blocks: 1122832    

Description Peter Vreman 2015-09-23 13:24:26 UTC
Description of problem:
The subcommands 'add-version' and 'remove-version' are confusing with the 'versions' subcommand.
Secondly the documentation of the commands is useless with a generic remark that the content view is updated and not what it actually updates

# hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml content-view --help
Usage:
    hammer content-view [OPTIONS] SUBCOMMAND [ARG] ...

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

Subcommands:
 add-repository                Associate a resource
 add-version                   Update a content view
 create                        Create a content view
 delete                        Delete a content view
 filter                        View and manage filters
 info                          Show a content view
 list                          List content views
 publish                       Publish a content view
 puppet-module                 View and manage puppet modules
 remove                        Remove versions and/or environments from a content view and reassign systems and keys
 remove-from-environment       Remove a content view from an environment
 remove-repository             Disassociate a resource
 remove-version                Update a content view
 update                        Update a content view
 version                       View and manage content view versions

Options:
 -h, --help                    print help

In fact the 'add-version' and 'remove-version' is related to the API variable called components and the webUI 'content view'

This can also be seen with the output of remove-version:
# hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml content-view remove-version  --organization-id=3 --id=13 --content-view-version-id=90
The component version has been removed





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


How reproducible:


Steps to Reproduce:
1. See in general description.
2.
3.

Actual results:


Expected results:
Please rename the variables to what they really do, as 'version' is too generic name.
Proposals is to stay consistent with the API and change it to 
- add-content-view-version-id
- remove-content-view-version-id

And for the description e.g. 'Associate a content view version (for composite content views only)'


Additional info:
The add-content-view-version-id is still a poor user-experience. It would be better to have a subcommand with additional option
- add-content-view
     --add-id | --add-name
     --add-environment
     --add-version
     --add-version-id

Comment 2 Andrew Kofink 2016-04-13 15:04:02 UTC
I feel like the version subcommand should allow adding/removing versions, as is consistent with the rest of the hammer interface. The add-version and remove-version subcommands on content-view should really be replaced with `content-view version create` and `content-view version delete`.

Secondly, I think we should make an effort to have valid descriptions for all hammer [sub]commands, but I think this should be a distinct bug, which I can create.

Any feedback is appreciated.

Comment 3 Andrew Kofink 2016-04-13 15:56:36 UTC
Created redmine issue http://projects.theforeman.org/issues/14620 from this bug

Comment 4 Andrew Kofink 2016-04-15 12:42:11 UTC
This is fixed with https://github.com/Katello/hammer-cli-katello/pull/377

Duplicate of http://projects.theforeman.org/issues/14444

Comment 5 jcallaha 2016-06-09 20:13:25 UTC
Verified in Satellite 6.2 beta Snap 15.

You can delete versions with the 'version' sub-command.

[root@apollo pulp]# hammer content-view version --help
Usage:
    hammer content-view version [OPTIONS] SUBCOMMAND [ARG] ...

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

Subcommands:
 delete                        Remove content view version
 export                        Export a content view version
 incremental-update            Perform an Incremental Update on one or more Content View Versions
 info                          Show content view version
 list                          List content view versions
 promote                       Promote a content view version

Comment 6 Bryan Kearney 2016-07-27 11:27:35 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/RHBA-2016:1501