Bug #24609
closedUnassigning policy from host does not delete Asset
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.
Updated by The Foreman Bot over 6 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ondřej Pražák
- Pull request https://github.com/theforeman/foreman_openscap/pull/350 added
Updated by Marek Hulán over 6 years ago
- Status changed from Ready For Testing to Resolved
turns out it's not a problem because it gets cleaned after host deletion, so marking as resolved for now
Updated by Ondřej Pražák about 5 years ago
- Related to Bug #27959: "undefined method `policies' for nil:NilClass" when assigning a policy added