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 over 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 #1

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
Actions #2

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

Actions #3

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
Actions

Also available in: Atom PDF