Bug 2044946

Summary: compliance status hash column overwritten by the syspurpose compliance hash
Product: [Community] Candlepin Reporter: Nikos Moumoulidis <nmoumoul>
Component: candlepinAssignee: candlepin-bugs
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.0CC: candlepin-bugs, redakkan
Target Milestone: ---Keywords: Triaged
Target Release: 4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: candlepin-4.0.16-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2044944 Environment:
Last Closed: 2022-02-22 08:09:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nikos Moumoulidis 2022-01-25 11:19:39 UTC
+++ This bug was initially created as a clone of Bug #2044944 +++

Description of problem:
"syspurpose compliance" and the "subscription compliance" are sharing the same "compliancestatushash" column in the cp_consumer table so after calculating the syspurpose compliance, Candlepin will replace the column with its digest

Version-Release number of selected component (if applicable):
All versions of candlepin that support system purpose so far

How reproducible:
100%

Steps to Reproduce:
1. Register a client
2. Set a syspurpose attribute on the client (e.g. role)
3. Check the database column cp_consumer.sp_status_hash for that consumer

Actual results:
It is null

Expected results:
It should contain a hash value

Additional info:
The offending code is here: https://github.com/candlepin/candlepin/blob/50b7144dc13c9688add43c3e716851f6430e5dfc/src/main/java/org/candlepin/policy/SystemPurposeComplianceRules.java#L274-L277
the getSystemPurposeStatusHash/setSystemPurposeStatusHash methods should be used instead.