Bug 860815
| Summary: | Agent updating resources from null to empty string version | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Elias Ross <genman> |
| Component: | Agent | Assignee: | John Mazzitelli <mazz> |
| Status: | ON_QA --- | QA Contact: | |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 4.2 | CC: | hrupp, mazz |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 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: | |||
Alternatively, the server could convert null strings into empty strings when loading from Oracle. I have done this before using Hibernate/JPA by annotating a @PostLoad method. Mazz I think this makes sense - those change messages are annoying. What do you think? i'll take a look. it seems to make sense to change this. I made that change to master branch. git commit 6ee04e0 |
Description of problem: If there is no component version, in other words an empty string, this is stored as ''. Oracle translates this value into null when read. Then the RHQ agent thinks the version was changed for this resource. 2012-09-26 18:57:07,396 INFO [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Version of [Resource[id=59062, type=Script, key=twiddle.sh, name=twiddle.sh, parent=AS default8180]] changed from [null] to [] The change is fairly straightforward diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq index b3f7fa9..8745971 100644 --- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java +++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java @@ -2683,7 +2683,7 @@ private InventoryContext getInventoryContext(Resource resource) { private void updateResourceVersion(Resource resource, String version) { String existingVersion = resource.getVersion(); - boolean versionChanged = (existingVersion != null) ? !existingVersion.equals(version) : version != null; + boolean versionChanged = (existingVersion != null) ? !existingVersion.equals(version) : version != null && !version.isEmpty(); if (versionChanged) { if (log.isDebugEnabled()) { log.debug("Discovery reported that version of [" + resource + "] changed from [" + existingVersion