Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation and API bug for dedicated servers #61

Closed
fpoyer opened this issue Mar 13, 2018 · 1 comment
Closed

Documentation and API bug for dedicated servers #61

fpoyer opened this issue Mar 13, 2018 · 1 comment

Comments

@fpoyer
Copy link

fpoyer commented Mar 13, 2018

Hi!
Sorry, this is not strictly speaking a python-ovh related issue, but I found it using the client and don't know how to contact the server-side developpers... feel free to transfer the issue to whomever is better qualified to handle it.

First bug is a documentation bug on the web interface of the API (https://eu.api.ovh.com/console/#/dedicated/server/%7BserviceName%7D/serviceInfos#PUT), the python tab show the following code (using "my-server" as service name placeholder):

result = client.put('/dedicated/server/my-server/serviceInfos', 
    renew='{"manualPayment":true,"forced":false,"automatic":false,"deleteAtExpiration":false}', // Way of handling the renew (type: service.RenewType)
)

but this doesn't work!
Actual working code is:

client.put('/dedicated/server/my-server/serviceInfos',
    renew={"manualPayment":True,"forced":False,"automatic":False,"deleteAtExpiration":False}
)

(using correct python structure that will be turned into json by the client, instead of json string that I guess will be turned into "json-ified" json \{\"manualPayment\":true,\"forced\":false,\"automatic\":false,\"deleteAtExpiration\":false\})

Second bug is in the API itself and is made of several smaller problems:

  • first: the manualPayment and deleteAtExpiration do not work as expected. When trying to switch a server that is on automatic payment (call to GET /dedicated/server/my-server/serviceInfos returns "automatic":true,"manualPayment":false,"deleteAtExpiration":false,"period":1} ), I would expect to pass renew={"manualPayment":True,"forced":False,"automatic":False,"deleteAtExpiration":True} to PUT /dedicated/server/my-server/serviceInfos but then I get ovh.exceptions.BadParametersError: Arguments conflicting. Indeed I have to pass renew={"manualPayment":True,"forced":False,"automatic":False,"deleteAtExpiration":False} which does toggle the state of the server to manual payment AND delete at expiration (call to GET /dedicated/server/my-server/serviceInfos returns "automatic":false,"manualPayment":true,"deleteAtExpiration":true,"period":1} ). But calling the exact same code again (manual: true, deleteAtExpiration: false) will toggle the server back to automatic payment!
  • second: automatic and manualPayment parameters (for the same endpoint) are mutually exclusive (if it is automatic, it can't be manual, and vice-versa) so this is redundant at best, error-prone at worst.
  • third (as bonus): forced is useless, as it can't be changed but is mandatory all the same. ovh.exceptions.BadParametersError: Can not change forced field of the service if you try to change it, ovh.exceptions.BadParametersError: [renew] Missing properties: (forced) for type RenewType if missing
@rbeuque74
Copy link
Member

Please contact the official OVH API mailing-list for this non-related python-ovh issue.
Mailing list information are available here: https://github.com/ovh/python-ovh/blob/master/README.rst#ovh-europe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants