Bug 1546021
Summary: | Cannot add repositories to content view with repository name using hammer | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Diksha Chaudhari <dchaudha> |
Component: | Content Views | Assignee: | Partha Aji <paji> |
Status: | CLOSED WONTFIX | QA Contact: | Lai <ltran> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.2.0 | CC: | bbuckingham, cmarinea, egolov, mruzicka, mverma, paji, rankumar |
Target Milestone: | 6.6.0 | Keywords: | Triaged |
Target Release: | Unused | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | tfm-rubygem-hammer_cli_katello-0.18.0-0 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-07-08 03:45:08 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
Diksha Chaudhari
2018-02-16 05:35:02 UTC
This appears to be an issue also on Satellite 6.3; however, the behavior is slightly different. In 6.3, the CV is updated; however, the first repository in the list is added to the content view. E.g. hammer> content-view update --id 4 --repositories 'Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server, Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.4' --organization "Default Organization" Content view updated The above will add "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server" to the CV. The PUT request sent to the server, will only contain the ID of that repository vs an array of IDs. E.g. [I] Started PUT "/katello/api/content_views/4" for 192.168.121.66 at 2018-02-19 19:36:28 +0000 [I] Processing by Katello::Api::V2::ContentViewsController#update as JSON [I] Parameters: {"repository_ids"=>[2], "api_version"=>"v2", "id"=>"4", "content_view"=>{"repository_ids"=>[2]}} Verified in a test 6.4 environment and a customer 6.3 environment - appears we have two issues that can cause failure using hammer content-view update by name. Issue 1: The original issue described in the description can fail if there are more than 20 repos in an organization. This may appear to succeed with a "Content view updated", but actual fail to add all requested repos. Issue #1 workaround: Increase the entries_per_page value to a sufficiently high number to cover all possible repos. Example: hammer settings set --name=entries_per_page --value=100 Issue 2: If there are multiple organizations with repos sharing the same name (ie "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server") it may with the error "Cannot add a repository from an Organization other than $ORG." It appears the content-view update by name logic builds a list of repository IDs from the repo names provided. When it pulls the list of repository names it does not appear to honor the --organization flag and instead pulls ALL repos for ALL orgs. The repo id map it then creates internally may include repos for other organizations, causing the failure. Issue #2 workaround: It appears you must manually build a list of repository IDs for the specific organization and use content-view update using --repository-ids instead of --repositories by name. ---- It seems it would be recommended to avoid using content-view update with --repositories by name if you have multiple organizations with duplicate repository names. Connecting redmine issue https://projects.theforeman.org/issues/26091 from this bug Connecting redmine issue https://projects.theforeman.org/issues/26095 from this bug Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26091 has been resolved. Ok sounds like there are layers to this but I propose they be separate bugs 1) If you gave a non existent repository name, The Content View update will show up as "updated" and no repositories added. However adding a valid repo seems to work ok """ [vagrant@zeta hammer-cli-katello]$ hammer content-view list ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- CONTENT VIEW ID | NAME | LABEL | COMPOSITE | LAST PUBLISHED | REPOSITORY IDS ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- 2 | Default Organization View | 0b440a8c-818a-4284-be08-c82705480eba | | 2019/06/12 21:52:06 | 1 | Default Organization View | Default_Organization_View | | 2019/06/08 06:01:49 | 3 | myview | myview | | | 8 ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- [vagrant@zeta hammer-cli-katello]$ hammer content-view update --id=3 --repositories=joy --product=joy --organization-id=1 Content view updated. [vagrant@zeta hammer-cli-katello]$ hammer content-view list ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- CONTENT VIEW ID | NAME | LABEL | COMPOSITE | LAST PUBLISHED | REPOSITORY IDS ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- 2 | Default Organization View | 0b440a8c-818a-4284-be08-c82705480eba | | 2019/06/12 21:52:06 | 1 | Default Organization View | Default_Organization_View | | 2019/06/08 06:01:49 | 3 | myview | myview | | | 8 ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- [vagrant@zeta hammer-cli-katello]$ hammer content-view update --id=3 --repositories=joylessExistence --product=joy --organization-id=1 Content view updated. [vagrant@zeta hammer-cli-katello]$ hammer content-view list ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- CONTENT VIEW ID | NAME | LABEL | COMPOSITE | LAST PUBLISHED | REPOSITORY IDS ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- 2 | Default Organization View | 0b440a8c-818a-4284-be08-c82705480eba | | 2019/06/12 21:52:06 | 1 | Default Organization View | Default_Organization_View | | 2019/06/08 06:01:49 | 3 | myview | myview | | | ----------------|---------------------------|--------------------------------------|-----------|---------------------|--------------- """ 2) Repositories are uniquely scoped per product. This means we are stuck with a limitation when repository names are provided. The anomaly in the behavior of this call is that You can do something like hammer content-view update --id=3 --repository-ids=1,2,3,4,5 while using name you are forced to provide a product id hammer content-view update --id=3 --repositories="Foo, Bar" --product-id=1 Which means you can only add repositories belonging to a single product to the content view. I believe both of the above cases need to get solved as separate issues and not be connected with this. More over there are "hammer content-view add-repository" and "remove-repository" commands for the user if they want fine grained control. So a 3 rd option could be just not supporting the --repositories flag at all. Created: https://bugzilla.redhat.com/show_bug.cgi?id=1727685 KCS was updated and workaround has been provided here -> https://access.redhat.com/solutions/3365661 Closing this as wontfix. Use the other bz to track deprecation of the --repositories command. |