Bug #14367
closedOnce you add a repo to a content view, you cannot remove it
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1321129
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