You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I request a tag from Nexpose API, I got all information about it. This includes name, associated_asset_ids, search_criteria etc.
Expected Behavior
When I only update some tag.associated_asset_ids and the tag has also search_criteria, the tag should be updated without any issue.
Current Behavior
After updating of existing tag object for values in tag.associated_asset_ids, I do a tag.save(connection) and get an Error HTTP 500. Tags without search criteria can be updated without problems and I get HTTP 200 answer from Nexpose.
After some research I found the reason, but I don't understand why it is raised without change anything für search_criteria.
2018-02-04T12:29:16 [WARN] [Thread: http-nio-443-exec-172=/api/2.0/tags/9767] Encountered an internal server error.
org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO tag_criteria_asset_bridge (tag_id, asset_id) VALUES (?, ?)]; ERROR: duplicate key value violates unique constraint "tag_criteria_asset_bridge_pkey"
Detail: Key (tag_id, asset_id)=(9767, 3705) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "tag_criteria_asset_bridge_pkey"
Detail: Key (tag_id, asset_id)=(9767, 3705) already exists.
Your Environment
Nexpose gem version: 7.2.0
Ruby version: 2.5.0p0 (2017-12-25 revision 61468)
Operating System and version: CentOS
Nexpose product version: 6.5.4
Thanks for any support.
The text was updated successfully, but these errors were encountered:
This functionality was broken in 7.1.1 last I checked and I believe that is still the case in 7.2.0 based on commit activity. As a workaround, I recommend doing the following:
Save the current tag criteria to a variable
Clear the tag's criteria using the below code sample where nsc is your Nexpose::Connection object and tag.id is the ID of the tag.
This could be from a change on the underlying API in Nexpose as I didn't see any changes in the gem that would have caused this, at least from a quick glance.
Also instead of modifying the associated_asset_ids property directly I recommend using the tag.add_to_asset method for manually tagging assets.
When I request a tag from Nexpose API, I got all information about it. This includes name, associated_asset_ids, search_criteria etc.
Expected Behavior
When I only update some tag.associated_asset_ids and the tag has also search_criteria, the tag should be updated without any issue.
Current Behavior
After updating of existing tag object for values in tag.associated_asset_ids, I do a tag.save(connection) and get an Error HTTP 500. Tags without search criteria can be updated without problems and I get HTTP 200 answer from Nexpose.
After some research I found the reason, but I don't understand why it is raised without change anything für search_criteria.
2018-02-04T12:29:16 [WARN] [Thread: http-nio-443-exec-172=/api/2.0/tags/9767] Encountered an internal server error.
org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO tag_criteria_asset_bridge (tag_id, asset_id) VALUES (?, ?)]; ERROR: duplicate key value violates unique constraint "tag_criteria_asset_bridge_pkey"
Detail: Key (tag_id, asset_id)=(9767, 3705) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "tag_criteria_asset_bridge_pkey"
Detail: Key (tag_id, asset_id)=(9767, 3705) already exists.
Your Environment
Thanks for any support.
The text was updated successfully, but these errors were encountered: