Project

General

Profile

Actions

Bug #24609

closed

Unassigning policy from host does not delete Asset

Added by Ondřej Pražák over 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce:

1) check the current state in console with ForemanOpenscap::Asset.all and ForemanOpenscap::AssetPolicy.all
2) assign policy to newly provisioned host
3) review the state in console again, new Asset and AssetPolicy are created as a result of step 2
4) unassign policy from host
5) review state in console - AssetPolicy was deleted but Asset remains

Asset exists only to enable the polymorphic association between policy and host(group), there is no need to keep it after the relation to the policy is removed. On the other hand, HostgroupExtension has :dependent => :destroy for the asset relation, but HostExtension does not. The simplest solution would be to add it there as well to make sure asset is destroyed when host is.


Related issues 1 (0 open1 closed)

Related to OpenSCAP - Bug #27959: "undefined method `policies' for nil:NilClass" when assigning a policy ClosedOndřej PražákActions
Actions

Also available in: Atom PDF