linode / linode_api4-python

Official Python bindings for the Linode API
https://linode-api4.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
135 stars 75 forks source link

Can't save() changes on LKENodePool #203

Closed lessmian closed 3 years ago

lessmian commented 3 years ago

Hi.

I want to change count of linodes in LKE node pool, but i get error:

Traceback (most recent call last):
  File "main.py", line 92, in <module>
    pool.save()
  File "/home/lessmian/linode_k8s/.venv/lib/python3.8/site-packages/linode_api4/objects/base.py", line 156, in save
    resp = self._client.put(type(self).api_endpoint, model=self,
  File "/home/lessmian/linode_k8s/.venv/lib/python3.8/site-packages/linode_api4/linode_client.py", line 1298, in put
    return self._api_call(*args, method=self.session.put, **kwargs)
  File "/home/lessmian/linode_k8s/.venv/lib/python3.8/site-packages/linode_api4/linode_client.py", line 1261, in _api_call
    raise ApiError(error_msg, status=response.status_code, json=j)
linode_api4.errors.ApiError: 404: Not found;

Example code:

client = LinodeClient(TOKEN)
cluster = client.lke.clusters(LKECluster.tags == 'test_cluster')[0]
pool = cluster.pools[0]
pool.count = 2
pool.save()

I do some debug and it's because pool.cluster_id is None, so https://api.linode.com/v4/lke/clusters/None/pools/11111 is called, which obviously does not exists. Am I doing something wrong? Or any other step is needed to cluster_id be set?

Dorthu commented 3 years ago

Thanks for the report! This is fixed in version 5.1.2