Description of problem: When a restricted user trying to promote a content view, Satellite will attempt to destroy the puppet environment content view. This is due to the fact that the puppet environment content view doesn't have any organization and cause the restricted user cannot find it. Steps to Reproduce: 1. Create a content view with puppet modules 2. Publish and promote it to a life cycle environment, such as develop 3. Add the generated puppet content view environment to a hostgroup or host. 3. Go to Configure > Environment > click the puppet environment cv, such as KT_org_develop_my_puppet_cv_1_36 > remove all organizations > Submit 4. Logout and Login as a restricted user 5. Publish and promote the content view again, then you should get the following error. 337: Actions::Katello::ContentViewPuppetEnvironment::Destroy (error) [ 2375.02s / 0.15s ] Skip Started at: 2017-07-06 21:51:15 UTC Ended at: 2017-07-06 22:30:50 UTC Real time: 2375.02s Execution time (excluding suspended state): 0.15s Input: --- content_view_puppet_environment: id: <id> name: my-test-cv Output: --- {} Error: RuntimeError --- - "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.137/app/models/katello/model.rb:8:in `destroy!'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.137/app/lib/actions/katello/content_view_puppet_environment/destroy.rb:15:in `finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:528:in `block (2 levels) in execute_finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/stack.rb:26:in `call'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/stack.rb:26:in `pass'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware.rb:17:in `pass'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action/progress.rb:30:in `with_progress_calculation'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action/progress.rb:22:in `finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/stack.rb:22:in `call'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/stack.rb:26:in `pass'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware.rb:17:in `pass'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.137/app/lib/actions/middleware/keep_locale.rb:15:in `block in finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.137/app/lib/actions/middleware/keep_locale.rb:22:in `with_locale'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.137/app/lib/actions/middleware/keep_locale.rb:15:in `finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/stack.rb:22:in `call'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/stack.rb:26:in `pass'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware.rb:17:in `pass'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware.rb:38:in `finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/stack.rb:22:in `call'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/middleware/world.rb:30:in `execute'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:527:in `block in execute_finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:419:in `call'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:419:in `block in with_error_handling'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:419:in `catch'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:419:in `with_error_handling'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:526:in `execute_finalize'" - "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.4/lib/dynflow/action.rb:260:in The task has given a Runtime error without an error message. After some investigations, I found that puppet environment cannot be deleted because there is at least one hostgroup/host using it. Actual results: Satellite try to delete the puppet content view environment that is still in use by host/hostgroup Expected results: Satellite should not delete the puppet content view environment that is still in use by host/hostgroup
I've created an additional BZ describing the behavior that leads to this state. https://bugzilla.redhat.com/show_bug.cgi?id=1479736
Given the fix in https://bugzilla.redhat.com/show_bug.cgi?id=1479736 should also lead to fixing this issue, I'm closing this issue as duplicate. *** This bug has been marked as a duplicate of bug 1479736 ***