We recently discovered our JAMF instance had created a duplicate record for an iPad after it was wiped and re-enrolled. Since both records had the same serial_number, the jamf2snipe script was updating the Name and JAMF ID from the old record, then updating again with the new record for each sync. Logs show the JAMF API had sent back error 409, "Error: Duplicate serial number", after jamf2snipe updated the asset_tag field in JAMF from Snipe-It (which was successful). Here's what that error looked like in our logs:
INFO:root:Sucessfully updated _snipeit_mac_os_version_20 with: 18.7.1
INFO:root:Sucessfully updated _snipeit_jamf_id_38 with: 243
INFO:root:JAMF doesn't have the same asset tag as SNIPE so we'll update it because it should be authoritative.
WARNING:root:Got back an error response code:409 - b'<html>\n<head>\n <title>Status page</title>\n</head>\n<body style="font-family: sans-serif;">\n<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Conflict</p>\n<p>Error: Duplicate serial number</p>\n<p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10">here</a>.<br>\nPlease continue your visit at our <a href="/">home page</a>.\n</p>\n</body>\n</html>\n'
INFO:root:Device is a mobile device, updating the mobile device record
Since the script relies on serial_number being unique on both sides, I think it'd be helpful if it had an option to pre-parse and remove entries with duplicate serial_number where the last_enrolled_date_utc (or report_date / last_inventory_update) is older.
We recently discovered our JAMF instance had created a duplicate record for an iPad after it was wiped and re-enrolled. Since both records had the same serial_number, the jamf2snipe script was updating the Name and JAMF ID from the old record, then updating again with the new record for each sync. Logs show the JAMF API had sent back error 409, "Error: Duplicate serial number", after jamf2snipe updated the asset_tag field in JAMF from Snipe-It (which was successful). Here's what that error looked like in our logs:
Since the script relies on serial_number being unique on both sides, I think it'd be helpful if it had an option to pre-parse and remove entries with duplicate serial_number where the last_enrolled_date_utc (or report_date / last_inventory_update) is older.