-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
puppet_to_device42_sync_py/puppetexplore.py
Line 325 in 2cbf21a
| dev42._delete('ips/%s' % d_ip['id']) |
While implementing the script into our environment, I hit an error when the script tries to delete IP addresses. Testing the issue using a REST API tool yields the same result. POST is able to pull the correct entry but DELETE throws an error.
REST result:
{
"msg": "DELETE 404",
"code": 2
}
puppetexplore.py result:
021-01-29 20:24:19,486 ERROR Error(<class 'device42.Device42HTTPError'>) updating device <server>
Traceback (most recent call last):
File "/opt/inventory_sync/puppetexplore.py", line 369, in d42_update
dev42._delete('ips/%s' % d_ip['id'])
File "/opt/inventory_sync/device42.py", line 68, in _delete
return self._send("DELETE", path)
File "/opt/inventory_sync/device42.py", line 50, in _send
(method, path, resp.status_code, resp.text, data))
Device42HTTPError: HTTP DELETE (ips/2438) Error 500: {"msg": "DELETE 404", "code": 2} request was NoneAdding a trailing slash to the API path for DELETE fixes this issue. Suggested change:
dev42._delete('ips/%s/' % d_ip['id'])Or the following could possibly work also but that assumes other API DELETE paths require trailing slashes:
puppet_to_device42_sync_py/device42.py
Lines 67 to 68 in 2cbf21a
| def _delete(self, path): | |
| return self._send("DELETE", path) |
def _delete(self, path):
if not path.endswith('/'):
path += '/'
return self._send("DELETE", path)Metadata
Metadata
Assignees
Labels
No labels