Bug 1474249 - Satellite shouldn't allow to delete the default organization of a puppet content view environment generated by Katello.
Satellite shouldn't allow to delete the default organization of a puppet cont...
Status: CLOSED DUPLICATE of bug 1479736
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Content Views (Show other bugs)
6.2.10
Unspecified Unspecified
high Severity high (vote)
: Unspecified
: --
Assigned To: satellite6-bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-24 04:33 EDT by Hao Chang Yu
Modified: 2017-09-04 19:55 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1479736 (view as bug list)
Environment:
Last Closed: 2017-08-22 09:58:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hao Chang Yu 2017-07-24 04:33:44 EDT
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
Comment 15 Ivan Necas 2017-08-09 06:01:01 EDT
I've created an additional BZ describing the behavior that leads to this state.

https://bugzilla.redhat.com/show_bug.cgi?id=1479736
Comment 16 Ivan Necas 2017-08-22 09:58:07 EDT
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 ***

Note You need to log in before you can comment on or make changes to this bug.