Bug 1600116

Summary: Audits taxonomies are being set from current context for non-taxable resources
Product: Red Hat Satellite Reporter: Roman Plevka <rplevka>
Component: Audit LogAssignee: Sebastian Gräßl <sgraessl>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: egolov, inecas, mhulan, sgraessl
Target Milestone: 6.4.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.18.0.26-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 19:00:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Roman Plevka 2018-07-11 13:06:56 UTC
Description of problem:
the taxonomies are being set even for resources that do not use them.
e.g. Architectures

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

Steps to Reproduce:
1. 
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Marek Hulan 2018-07-12 06:32:55 UTC
Steps to reproduce:

1. switch context so you're in org1 and loc1
2. create architecture
3. go to audits page, you should see the audit
4. switch to org2, you should still see the audit because architecture is non-taxable, the audit lives only in org1

Devs notes:

The problem is that since Audit is now taxable, when we do Audit.new its org and loc defaults to current context. This is caused by after_initialize :set_current_taxonomy defined in Taxonomix

To see the behavior in console do:

Organization.current = org1
Audit.new.organization_ids # => you'll get org1.id

We override the value for taxable resources, but for non-taxable, such as architecture, this is a problem. We should override :set_current_taxonomy method in audite extensions to become noop.

Comment 2 Marek Hulan 2018-07-12 06:33:37 UTC
Created redmine issue https://projects.theforeman.org/issues/24234 from this bug

Comment 6 Roman Plevka 2018-09-19 11:12:30 UTC
VERIFIED
on sat6.4.0-22

this is now behaving correctly (no taxonomy is assigned to non-taxable items).

Comment 7 Bryan Kearney 2018-10-16 19:00:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2927