Bug 1321129

Summary: Once you add a repo to a content view, you cannot remove it
Product: Red Hat Satellite Reporter: Og Maciel <omaciel>
Component: Content ManagementAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, ehelms, jcallaha
Target Milestone: UnspecifiedKeywords: PrioBumpQA, Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14367
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:28:57 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:
Attachments:
Description Flags
foreman debug none

Description Og Maciel 2016-03-24 17:58:37 UTC
Description of problem:

If you add a repository to a content view, you cannot remove it anymore. This can be demonstrated via the web ui and hammer cli.

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

* Satellite 6.2.0 SNAP 5.1

How reproducible:


Steps to Reproduce:
1. Create a custom product and repository (yum-based is ok)
2. Create a new content view
3. Add the new repository to it
4. Try to remove the repository from the content view (use the UI or hammer)


Actual results:

The repository is not removed. If using hammer, the message returned says the repository was removed but if you check it again you'll see that the repo is still there.


Expected results:


Additional info:

hammer> content-view info --name FooBar --organization-id 3
ID:                     7
Name:                   FooBar
Label:                  FooBar
Composite:              false
Description:
Content Host Count:     0
Organization:           IBM
Yum Repositories:

Docker Repositories:

OSTree Repositories:

Puppet Modules:

Lifecycle Environments:

Versions:

Components:

Activation Keys:

hammer> content-view add-repository --name FooBar --organization-id 3 --product 'Zoo Repo' --repository 'African Animals'
The repository has been associated


hammer> content-view info --name FooBar --organization-id 3ID:                     7
Name:                   FooBar
Label:                  FooBar
Composite:              false
Description:
Content Host Count:     0
Organization:           IBM
Yum Repositories:
 1) ID:    31
    Name:  African Animals
    Label: African_Animals
Docker Repositories:

OSTree Repositories:

Puppet Modules:

Lifecycle Environments:

Versions:

Components:

Activation Keys:

hammer> content-view remove-repository --name FooBar --organization-id 3 --product 'Zoo Repo' --repository 'African Animals'
The repository has been removed


hammer> content-view info --name FooBar --organization-id 3ID:                     7
Name:                   FooBar
Label:                  FooBar
Composite:              false
Description:
Content Host Count:     0
Organization:           IBM
Yum Repositories:
 1) ID:    31
    Name:  African Animals
    Label: African_Animals
Docker Repositories:

OSTree Repositories:

Puppet Modules:

Lifecycle Environments:

Versions:

Components:

Activation Keys:



Also,


==> /var/log/foreman/production.log <==
2016-03-24 13:46:57 [app] [I] Started PUT "/katello/api/v2/content_views/6?organization_id=3" for 10.10.62.185 at 2016-03-24 13:46:57 -0400
2016-03-24 13:46:57 [app] [I] Processing by Katello::Api::V2::ContentViewsController#update as JSON
2016-03-24 13:46:57 [app] [I]   Parameters: {"content_host_count"=>0, "composite"=>false, "repository_ids"=>nil, "component_ids"=>nil, "default"=>false, "next_version"=>1, "id"=>"6", "name"=>"MEaNAFSQaK", "label"=>"MEaNAFSQaK", "description"=>nil, "organization"=>{"name"=>"IBM", "label"=>"IBMORG", "id"=>3}, "created_at"=>"2016-03-24 13:20:35 -0400", "updated_at"=>"2016-03-24 13:20:35 -0400", "environments"=>nil, "repositories"=>[{"id"=>31, "name"=>"African Animals", "label"=>"African_Animals", "content_type"=>"yum"}], "puppet_modules"=>nil, "versions"=>nil, "components"=>nil, "activation_keys"=>nil, "last_published"=>nil, "permissions"=>{"view_content_views"=>true, "edit_content_views"=>true, "destroy_content_views"=>true, "publish_content_views"=>true, "promote_or_remove_content_views"=>true}, "organization_id"=>"3", "api_version"=>"v2", "content_view"=>{"id"=>"6", "name"=>"MEaNAFSQaK", "label"=>"MEaNAFSQaK", "description"=>nil, "default"=>false, "created_at"=>"2016-03-24 13:20:35 -0400", "updated_at"=>"2016-03-24 13:20:35 -0400", "composite"=>false, "next_version"=>1, "repository_ids"=>nil, "component_ids"=>nil}}

==> /var/log/httpd/foreman-ssl_error_ssl.log <==
[Thu Mar 24 13:46:57.926708 2016] [ssl:warn] [pid 25038] [client 10.10.62.185:63553] AH02227: Failed to set r->user to 'SSL_CLIENT_S_DN_CN', referer: https://cloud-qe-10.idmqe.lab.eng.bos.redhat.com/content_views/6/repositories/yum

==> /var/log/foreman/production.log <==
2016-03-24 13:46:58 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.9/app/views/katello/api/v2/common/update.json.rabl within katello/api/v2/layouts/resource (13.3ms)
2016-03-24 13:46:58 [app] [I] Completed 200 OK in 282ms (Views: 12.0ms | ActiveRecord: 53.6ms)
2016-03-24 13:46:58 [app] [I] Started GET "/katello/api/v2/repositories?content_type=yum&content_view_id=6&full_result=true&organization_id=3&page=1&search=" for 10.10.62.185 at 2016-03-24 13:46:58 -0400
2016-03-24 13:46:58 [app] [I] Processing by Katello::Api::V2::RepositoriesController#index as JSON
2016-03-24 13:46:58 [app] [I]   Parameters: {"content_type"=>"yum", "content_view_id"=>"6", "full_result"=>"true", "organization_id"=>"3", "page"=>"1", "search"=>"", "api_version"=>"v2"}
2016-03-24 13:46:58 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.9/app/views/katello/api/v2/repositories/index.json.rabl within katello/api/v2/layouts/collection (30.2ms)
2016-03-24 13:46:58 [app] [I] Completed 200 OK in 44ms (Views: 13.9ms | ActiveRecord: 20.4ms)

==> /var/log/httpd/foreman-ssl_access_ssl.log <==
10.10.62.185 - - [24/Mar/2016:13:46:57 -0400] "PUT /katello/api/v2/content_views/6?organization_id=3 HTTP/1.1" 200 359 "https://cloud-qe-10.idmqe.lab.eng.bos.redhat.com/content_views/6/repositories/yum" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Firefox/38.0"
10.10.62.185 - - [24/Mar/2016:13:46:58 -0400] "GET /katello/api/v2/repositories?content_type=yum&content_view_id=6&full_result=true&organization_id=3&page=1&search= HTTP/1.1" 200 356 "https://cloud-qe-10.idmqe.lab.eng.bos.redhat.com/content_views/6/repositories/yum" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Firefox/38.0"

==> /var/log/httpd/foreman-ssl_error_ssl.log <==
[Thu Mar 24 13:46:58.934495 2016] [ssl:warn] [pid 25038] [client 10.10.62.185:63553] AH02227: Failed to set r->user to 'SSL_CLIENT_S_DN_CN', referer: https://cloud-qe-10.idmqe.lab.eng.bos.redhat.com/content_views/6/repositories/yum

Comment 2 Brad Buckingham 2016-03-28 19:35:14 UTC
Created redmine issue http://projects.theforeman.org/issues/14367 from this bug

Comment 3 Bryan Kearney 2016-03-28 20:03:35 UTC
Upstream bug component is Content Management

Comment 4 Brad Buckingham 2016-03-28 20:53:19 UTC
Upstream Katello PR: https://github.com/Katello/katello/pull/5918

Comment 5 Brad Buckingham 2016-03-29 14:28:48 UTC
Moved incorrect bug to POST... back to assigned.

Comment 6 Brad Buckingham 2016-03-29 16:23:35 UTC
The upstream fix has been merged; therefore, moving to POST.

Be aware of the following:
- the issue applied to either removing repositories from a content view or component views from a composite view
- the issue would surface when attempting to remove 'all' of those objects from the content view... (e.g. removing all N repositories or component views, such that the resultant behavior would be an empty list)

Comment 7 jcallaha 2016-04-06 14:32:20 UTC
Failed QA in Satellite 6.2 Beta Snap 6 Compose 2. 

Removing one repo or content view from a composite works. However, publishing a content view or composite fails with the error below when removing all contents.

Runtime Error null at org.candlepin.model.AbstractHibernateCurator.delete:326

Attaching foreman-debug output.

Comment 8 jcallaha 2016-04-06 14:32:49 UTC
Created attachment 1144238 [details]
foreman debug

Comment 9 Brad Buckingham 2016-04-06 14:53:57 UTC
Hi Jake,

The error raised in comment 7 is not directly related to this bug.  It does, however, look similar to bug 1276479#c8 and bug 1323751.

Comment 10 jcallaha 2016-04-06 15:09:24 UTC
With Brad's clarification, I will defer the issue that I encountered to the bug he listed in comment 9.

Verified

Comment 12 errata-xmlrpc 2016-07-27 09:28:57 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