Bug 1293889 - ContentView delete fails in finalize instead of plan
Summary: ContentView delete fails in finalize instead of plan
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.1.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: Unspecified
Assignee: Katello Bug Bin
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2015-12-23 11:48 UTC by Peter Vreman
Modified: 2019-09-26 13:56 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-07 11:38:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Peter Vreman 2015-12-23 11:48:32 UTC
Description of problem:
Deleting a ContentView that is still in use fails in the finalize step and leaves the task on paused instead of failing in the plan phase:

Id: 8dcf3784-602b-4592-a7b5-f47f30fdbfce
Label: Actions::Katello::ContentView::Destroy
Name: Delete
Owner: hoici
Started at: 2015-12-22 19:06:58 UTC
Ended at:
State: paused
Result: error
Params: content view 'hg-crash::DMZ-DNS'; organization 'Hilti'
100.0% Complete
100%
Errors:

Cannot delete record because of dependent hosts


[crash] root@li-lc-1017:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3}" -XGET https://localhost/katello/api/content_views/84 | jq .
{
  "content_host_count": 0,
  "activation_keys": [],
  "components": [
    {
      "repositories": [
        {
          "label": "HOIRHEL-6_6-d20151011",
          "name": "HOIRHEL-6.6-d20151011",
          "id": 1241
        },
        {
          "label": "Red_Hat_Enterprise_Linux_6_Server_-_Extended_Update_Support_-_Optional_RPMs_x86_64_6_6",
          "name": "Red Hat Enterprise Linux 6 Server - Extended Update Support - Optional RPMs x86_64 6.6",
          "id": 1242
        },
        {
          "label": "Red_Hat_Enterprise_Linux_6_Server_-_Extended_Update_Support_-_Oracle_Java_RPMs_x86_64_6_6",
          "name": "Red Hat Enterprise Linux 6 Server - Extended Update Support - Oracle Java RPMs x86_64 6.6",
          "id": 1243
        },
        {
          "label": "Red_Hat_Enterprise_Linux_6_Server_-_Extended_Update_Support_RPMs_x86_64_6_6",
          "name": "Red Hat Enterprise Linux 6 Server - Extended Update Support RPMs x86_64 6.6",
          "id": 1244
        },
        {
          "label": "Red_Hat_Enterprise_Linux_6_Server_Kickstart_x86_64_6_6",
          "name": "Red Hat Enterprise Linux 6 Server Kickstart x86_64 6.6",
          "id": 1245
        },
        {
          "label": "Red_Hat_Enterprise_Linux_Load_Balancer_for_RHEL_6_Server_-_Extended_Update_Support_RPMs_x86_64_6_6",
          "name": "Red Hat Enterprise Linux Load Balancer for RHEL 6 Server - Extended Update Support RPMs x86_64 6.6",
          "id": 1246
        },
        {
          "label": "Red_Hat_Satellite_Tools_6_1_for_RHEL_6_Server_-_EUS_RPMs_x86_64_6_6",
          "name": "Red Hat Satellite Tools 6.1 for RHEL 6 Server - EUS RPMs x86_64 6.6",
          "id": 1247
        },
        {
          "label": "Red_Hat_Software_Collections_RPMs_for_Red_Hat_Enterprise_Linux_6_RHEL_6_Server_EUS_x86_64_6_6",
          "name": "Red Hat Software Collections RPMs for Red Hat Enterprise Linux 6 RHEL 6 Server EUS x86_64 6.6",
          "id": 1249
        }
      ],
      "content_view": {
        "next_version": 3,
        "description": null,
        "label": "product-HOIRHEL-6_6-d20151011",
        "name": "product-HOIRHEL-6.6-d20151011",
        "id": 60
      },
      "environments": [
        {
          "label": "Library",
          "name": "Library",
          "id": 2
        }
      ],
      "puppet_module_count": 0,
      "version": "2.0",
      "content_view_id": 60,
      "name": "product-HOIRHEL-6.6-d20151011 2.0",
      "id": 130
    },
    {
      "repositories": [
        {
          "label": "HOIOS-6_6_0-hf5",
          "name": "HOIOS-6.6.0-hf5",
          "id": 1670
        }
      ],
      "content_view": {
        "next_version": 2,
        "description": null,
        "label": "product-HOIOS-6_6_0-hf5",
        "name": "product-HOIOS-6.6.0-hf5",
        "id": 73
      },
      "environments": [
        {
          "label": "Library",
          "name": "Library",
          "id": 2
        }
      ],
      "puppet_module_count": 48,
      "version": "1.0",
      "content_view_id": 73,
      "name": "product-HOIOS-6.6.0-hf5 1.0",
      "id": 177
    },
    {
      "repositories": [
        {
          "label": "HOIPRODUCTS-1_1_0-hf4",
          "name": "HOIPRODUCTS-1.1.0-hf4",
          "id": 1742
        }
      ],
      "content_view": {
        "next_version": 2,
        "description": null,
        "label": "product-HOIPRODUCTS-1_1_0-hf4",
        "name": "product-HOIPRODUCTS-1.1.0-hf4",
        "id": 74
      },
      "environments": [
        {
          "label": "Library",
          "name": "Library",
          "id": 2
        }
      ],
      "puppet_module_count": 23,
      "version": "1.0",
      "content_view_id": 74,
      "name": "product-HOIPRODUCTS-1.1.0-hf4 1.0",
      "id": 185
    }
  ],
  "versions": [],
  "puppet_modules": [],
  "composite": true,
  "updated_at": "2015-11-11T14:15:25Z",
  "created_at": "2015-11-11T14:15:25Z",
  "organization": {
    "id": 3,
    "label": "Hilti",
    "name": "Hilti"
  },
  "description": null,
  "label": "hg-crash__DMZ-DNS",
  "name": "hg-crash::DMZ-DNS",
  "id": 84,
  "repository_ids": [],
  "component_ids": [
    130,
    177,
    185
  ],
  "default": false,
  "next_version": 2,
  "last_published": null,
  "permissions": {
    "promote_or_remove_content_views": true,
    "publish_content_views": true,
    "destroy_content_views": true,
    "edit_content_views": true,
    "view_content_views": true
  },
  "environments": [],
  "repositories": []
}

[crash] root@li-lc-1017:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3}" -XDELETE https://localhost/katello/api/content_views/84
{"id":"bcdc47f9-b3fc-497a-b8cd-fabae5216f25","label":"Actions::Katello::ContentView::Destroy","pending":true,"username":"hoici","started_at":"2015-12-23T11:38:39Z","ended_at":null,"state":"running","result":"pending","progress":0.5,"input":{"content_view":{"id":84,"name":"hg-crash::DMZ-DNS","label":"hg-crash__DMZ-DNS"},"organization":{"id":3,"name":"Hilti","label":"Hilti"},"remote_user":"hoici-53fba4ca","remote_cp_user":"hoici","locale":"en"},"output":{},"humanized":{"action":"Delete","input":[["content_view",{"text":"content view 'hg-crash::DMZ-DNS'","link":"#/content_views/84/versions"}],["organization",{"text":"organization 'Hilti'","link":"/organizations/3/edit"}]],"output":"","errors":["Cannot delete record because of dependent hosts"]},"cli_example":null}

Also note:
- Our custom housekeeping job already removed the ContentView from all lifecycle without errors
- Our custom housekeeping job also removed all ContentViewVersions without errors
- No ContentHosts are attached anymore


That means the ContentView is not published and also not used anymore, but it still does this error check:
- In the wrong place
- The error check might also be wrong there is nothing that uses this CV anymore


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


How reproducible:


Steps to Reproduce:
1. Delete a ContentView that is still in use by a ContentHost
2. 
3.

Actual results:
Plan phase does not check if the ContentView is still in used

Expected results:
Plan phase is stopped with error if the ContentView is still in use


Additional info:


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Peter Vreman 2016-03-07 11:38:30 UTC
Closing this is fixed in 6.1.6, same as BZ1294470

[crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3}" -XDELETE https://localhost/katello/api/content_views/29/environments/2

{"displayMessage":"Cannot remove 'hg-crash::IPS::Test-6.6.0-ci' from environment 'Library' due to associated systems: li-lc-1442.hag.hilti.com. Cannot remove 'hg-crash::IPS::Test-6.6.0-ci' from environment 'Library' due to associated activation keys: hg-crash::IPS::Test-6.6.0-ci.","errors":["Cannot remove 'hg-crash::IPS::Test-6.6.0-ci' from environment 'Library' due to associated systems: li-lc-1442.hag.hilti.com. Cannot remove 'hg-crash::IPS::Test-6.6.0-ci' from environment 'Library' due to associated activation keys: hg-crash::IPS::Test-6.6.0-ci."]}

[crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3}" -XDELETE https://localhost/katello/api/content_views/29
{"displayMessage":"Cannot delete 'hg-crash::IPS::Test-6.6.0-ci' due to associated environments: Library. Cannot delete 'hg-crash::IPS::Test-6.6.0-ci' due to associated systems: li-lc-1442.hag.hilti.com. Cannot delete 'hg-crash::IPS::Test-6.6.0-ci' due to associated activation keys: hg-crash::IPS::Test-6.6.0-ci.","errors":["Cannot delete 'hg-crash::IPS::Test-6.6.0-ci' due to associated environments: Library. Cannot delete 'hg-crash::IPS::Test-6.6.0-ci' due to associated systems: li-lc-1442.hag.hilti.com. Cannot delete 'hg-crash::IPS::Test-6.6.0-ci' due to associated activation keys: hg-crash::IPS::Test-6.6.0-ci."]}


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