Bug 1309944 - [RFE] Create/update composite content-view by content-view Names
[RFE] Create/update composite content-view by content-view Names
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Hammer - Content (Show other bugs)
6.1.5
x86_64 Linux
unspecified Severity medium (vote)
: GA
: --
Assigned To: Andrew Kofink
Peter Ondrejka
http://projects.theforeman.org/issues...
: FutureFeature, Triaged
Depends On:
Blocks: 1167688
  Show dependency treegraph
 
Reported: 2016-02-18 23:01 EST by Amar Huchchanavar
Modified: 2018-02-21 07:34 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-02-21 07:34:46 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 14604 None None None 2016-04-26 13:05 EDT
Red Hat Product Errata RHSA-2018:0336 normal SHIPPED_LIVE Important: Satellite 6.3 security, bug fix, and enhancement update 2018-02-21 17:43:42 EST

  None (edit)
Comment 2 Andrew Kofink 2016-03-07 16:15:23 EST
Katello::content_view names are unique to an organization, so we should be able to use find_by(name: ['name1', 'name2']).
Comment 3 Andrew Kofink 2016-03-07 16:40:35 EST
Also, in order to add a content view to a composite view you must first publish an initial version of the content view. Right now, if finding components by ID, if you give hammer 4 IDs and only 3 are found, nothing happens. The same will be true of arrays that contain content_view names that are yet unpublished or do not exist.
Comment 4 Andrew Kofink 2016-03-08 10:56:24 EST
Finding ContentViewVersion (CVV) objects by ContentView (CV) names may return multiple CVV objects. Should I make all CVVs a component of the parent CV, or should I add only the latest CVVs based on latest major.minor version number?
Comment 5 Andrew Kofink 2016-03-16 10:24:21 EDT
In order to get the latest CVV for a CV, this feature needs to be implemented as well: https://bugzilla.redhat.com/show_bug.cgi?id=1167688
Comment 7 Andrew Kofink 2016-04-13 08:05:25 EDT
Created redmine issue http://projects.theforeman.org/issues/14604 from this bug
Comment 8 Andrew Kofink 2016-05-02 08:29:51 EDT
CLI users can add a version to a composite with content view name, minor, and major options (e.g. `hammer content-view add-version --id 1 --component-content-view blah --component-major-version 1 --component-minor-version 2`)

Feedback on the PR states that this feature should not be implemented.
Comment 9 David Davis 2016-05-04 16:59:16 EDT
Andrew,

The parameters you mention should be there but they're not which means there is still a bug here. I would probably either fix as part of this bugzilla or open a new bugzilla.
Comment 10 David Davis 2016-05-04 17:02:06 EDT
By the way, sorry if there was any confusion in my PR feedback.
Comment 14 Andrew Kofink 2016-06-28 09:56:13 EDT
Final syntax:

hammer content-view add-version --id 2 --content-view-version 1.0 --content-view-version-content-view-id 3
hammer content-view remove-version --id 2 --content-view-version 1.0 --content-view-version-content-view-id 3
Comment 18 Peter Ondrejka 2016-10-19 08:59:18 EDT
Attempting to create a CCV on Satellite 6.3 snap 5:

# hammer content-view list

CONTENT VIEW ID | NAME        | LABEL     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|-------------|-----------|-----------|---------------------|---------------
5               | testview    | testview  |           | 2016/10/18 14:36:24 | 4, 2, 3       
3               | foo         | foo       |           | 2016/10/18 14:04:46 | 

When trying to create a composite with names (tried various versions with quotes for names, equal sign, etc.):

# hammer content-view create --name testcomposite --component-ids foo,testview --composite --organization-id 1
Could not create the content view:
  Couldn't find Katello::ContentViewVersion with 'id'=0

Whereas:
# hammer content-view create --name testcomposite --component-ids 5,3 --composite --organization-id 1
Content view created

Also, note that the change in functionality should be reflected in hammer help that currently reads:

Options:
 --component-ids COMPONENT_IDS           List of component content view version ids for composite views
                                         Comma separated list of values.

We should mention that component names can be used as well, maybe even change the option name that is strongly suggestive of IDs.
Comment 19 Bryan Kearney 2016-10-19 10:17:21 EDT
Upstream bug component is Hammer - Content
Comment 21 Andrew Kofink 2018-01-29 08:24:44 EST
--component-ids does not work with names, as demonstrated in Comment 18. The way to add/remove components by version name is the following:

hammer content-view add-version --id 2 --content-view-version 1.0 --content-view-version-content-view-id 3
hammer content-view remove-version --id 2 --content-view-version 1.0 --content-view-version-content-view-id 3

Remember that the components of a composite content view are content view versions, not content views.
Comment 22 Peter Ondrejka 2018-01-31 09:19:21 EST
Hi Andrew, looked again on Sat 6.3 snap 33, once I wrapped my head around it I can confirm the new member cvs can be added by name as this bug requested, though options look bit different:

]# hammer content-view add-version --id 3 --content-view test2 --content-view-version-id 2
The component version has been added

Though it would be nice if we could make help more informative for users, i.e. indicate which options relate to ccv and which to cv being added, currently we have:

~]# hammer content-view add-version -h
Usage:
    hammer content-view add-version [OPTIONS]

Options:
 --content-view CONTENT_VIEW_NAME                    Content view name to search by
 --content-view-id CONTENT_VIEW_ID                   content view numeric identifier
 --content-view-version CONTENT_VIEW_VERSION_VERSION Content view version number
 --content-view-version-id CONTENT_VIEW_VERSION_ID   Content view version identifier
 --id ID                                             content view numeric identifier
 --name NAME                                         Content view name to search by

Also trying to add a different version of a CV that is already in the CCV, fails, which is I suppose correct but the message could be more informative (not sure why I'm getting it twice):

~]# hammer content-view add-version --id 3 --content-view test2 --content-view-version-id 7
Could not add version:
  Validation failed: Content view components is invalid, Content view components is invalid

Anyways, let me know what you think
Comment 23 Andrew Kofink 2018-01-31 09:47:31 EST
Yes, the error could definitely be better. There are 2 error messages because the composite content view is what is being validated here (server-side), and both versions associated (the existing one, and the one you are trying to add) are marked as incorrect because they're from the same component content view. I'm not sure the error message should block this bug or be reported as a separate bug. I will leave that up to you.

As for the help output, I'm not sure I understand the confusion. All the options in the output you posted either say "content_view_*" or "content_view_version_*". Perhaps I'm missing something here?
Comment 24 Peter Ondrejka 2018-02-02 08:16:26 EST
Ok, I'm not going to block this bz on those nitpicks, I went with creating http://projects.theforeman.org/issues/22498

In that help I meant the right side, these explanations are the same for the cv and the ccv part.
Comment 25 Andrew Kofink 2018-02-02 09:36:41 EST
Ah, yeah I see what you mean. Specifically `--id` and `--content-view-id`. Thanks for reporting the issue! I cloned it to BZ and set ? for 6.3.z
Comment 28 errata-xmlrpc 2018-02-21 07:34:46 EST
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

Note You need to log in before you can comment on or make changes to this bug.