Katello::content_view names are unique to an organization, so we should be able to use find_by(name: ['name1', 'name2']).
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.
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?
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
Created redmine issue http://projects.theforeman.org/issues/14604 from this bug
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.
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.
By the way, sorry if there was any confusion in my PR feedback.
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
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.
Upstream bug component is Hammer - Content
--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.
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
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?
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.
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
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