-
Bug
-
Resolution: Fixed
-
Medium
-
5.4.0, 5.4.10
-
None
-
3
-
Severity 3 - Minor
-
17
-
Issue Summary
Updating an Assets object with unique attribute values multiple times in a short timespan will result in a ValidationInsightException with the message "The attribute '<Attribute Name>' has to be unique"
This is reproducible on Data Center: yes
Steps to Reproduce
- Create a new Assets schema as a 'Sample IT Asset Schema'. Just to get some object types in there automatically.
- In the newly created schema, go to the 'Host' object and edit the attributes.
- Add an attribute called 'Codename' with type 'Default', Type Value 'Text' and make it unique.
- Note down the attribute ID of this attribute.
- Go back to the object, and create a new Host object being sure to put a value in the 'Codename' attribute.
- Note down the ObjectID and ObjectTypeID from the URL.
- Run the following cURL command to edit the Object twice one after the other (Note you will need to fill in the following: username, password, baseURL, objectID, objectTypeID, attributeID):
for i in {1..2} do curl -u <username>:<password> -X 'PUT' \ '<baseURL>/rest/insight/1.0/object/<objectID>' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "objectTypeId": <objectTypeID>, "attributes": [ { "objectTypeAttributeId": <attributeID>, "objectAttributeValues": [ { "value": "Longhorn" } ] } ] }' done
Expected Results
Attribute value is updated successfully both times.
Actual Results
The first update succeeds but the second fails with the error "The attribute 'Codename' has to be unique"
The below exception is thrown in the xxxxxxx.log file:
[INFO] [talledLocalContainer] 2023-11-23 16:38:36,470 http-nio-2990-exec-3 url: /jira/rest/insight/1.0/object/32; user: admin INFO admin 998x24618x1 1mq3e3l 127.0.0.1 /rest/insight/1.0/object/32 [c.r.j.p.i.services.util.ServiceUtil] InsightException:ValidationInsightException: Validation errors were found: rlabs-insight-attribute-811: ErrorMessage{i18nKey='rlabs.insight.i18n.constraint.violation.unique', parameters=[Codename], additionalMessage=null}; [INFO] [talledLocalContainer] com.riadalabs.jira.plugins.insight.common.exception.ValidationInsightException: ValidationInsightException: Validation errors were found: rlabs-insight-attribute-811: ErrorMessage{i18nKey='rlabs.insight.i18n.constraint.violation.unique', parameters=[Codename], additionalMessage=null}; [INFO] [talledLocalContainer] at com.riadalabs.jira.plugins.insight.services.validation.ValidateObjectImpl.validateObjectBean(ValidateObjectImpl.java:229) [INFO] [talledLocalContainer] at com.riadalabs.jira.plugins.insight.services.core.ObjectServiceImpl.storeObject(ObjectServiceImpl.java:409) [INFO] [talledLocalContainer] at com.riadalabs.jira.plugins.insight.services.core.ObjectServiceImpl.storeObject(ObjectServiceImpl.java:283) [INFO] [talledLocalContainer] at com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.object.ObjectResource.updateObject(ObjectResource.java:391) [INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [talledLocalContainer] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Workaround
Wait at least 500ms in between updates for unique attributes
- is duplicated by
-
JSDSERVER-12676 ValidationInsightException when updating object attributes with unique values
-
- Closed
-
Form Name |
---|
[JSDSERVER-14880] Updating a unique assets attribute value results in ValidationInsightException
Resolution | New: Fixed [ 1 ] | |
Status | Original: Waiting for Release [ 12075 ] | New: Closed [ 6 ] |
Fix Version/s | Original: 15.15.0 [ 107097 ] | |
Fix Version/s | New: 5.15.0 [ 107090 ] |
Support reference count | Original: 2 | New: 3 |
UIS | Original: 40 | New: 17 |
Status | Original: In Progress [ 3 ] | New: Waiting for Release [ 12075 ] |
Fix Version/s | New: 15.15.0 [ 107097 ] |
Status | Original: Short Term Backlog [ 12074 ] | New: In Progress [ 3 ] |
Remote Link |
New:
This issue links to "Service Desk Master › JSM/DC - Snyk reports diff › stable-issue-15.15- |
Remote Link |
New:
This issue links to "Service Desk - Stable 5.15.x › Service Desk Find fix versions - Stable - 5.15.x › stable-issue-15.15- |
Remote Link |
New:
This issue links to "Service Desk - Stable 5.15.x › OBR generation for JSM (Service Desk - Stable 5.15.x) › stable-issue-15.15- |