iamkubi / pydactyl

Python wrapper for the Pterodactyl Panel API
MIT License
69 stars 21 forks source link

'ValidationException', 'status': '422', 'detail': 'The allocation has already been taken.' - when allocation is open #29

Closed astrooom closed 2 years ago

astrooom commented 3 years ago

This error occurs when updating a server build (not when creating a new server) and adding an allocation id, despite the allocation id not being already taken.

Let's say I have a server with the allocation id 58, and want to increase the allocation limit to 2, and add an allocation that is one port above the other (59) and know the allocation id of 59 isn't taken:

application.servers.update_server_build(125, 58, memory_limit=0, swap_limit=0, disk_limit=0, cpu_limit=0, io_limit=500, database_limit=1, allocation_limit=2, add_allocations=[59], remove_allocations=None, oom_disabled=True)

I get

'ValidationException', 'status': '422', 'detail': 'The allocation has already been taken.'

also, the backup_limit thing isn't fixed for update_server_build, and only works while creating a server ('ValidationException', 'status': '422', 'detail': 'The Backup Limit field must be present.').

astrooom commented 3 years ago

I can confirm that it does work properly when not increasing the allocation_limit at the same time as assigning an additional allocation, so fixable by making two server.update_server_build calls I suppose.

iamkubi commented 3 years ago

Thanks, it should definitely work with a single call. I'll take a look.

iamkubi commented 2 years ago

I think I changed my mind. Pterodactyl requires you to do this in separate API calls and I think that's reasonable. You need to adjust the limit before you can update the limit to exceed it.