Delete an account by using Rancher Api

I use gdapi python lib

Both ACCESS_KEY and SECRET_KEY are the “Account API Keys”.
$ gdapi delete-account --id=1a3271

Error : {‘status’: 405, ‘code’: u’Method not allowed’, ‘links’: {}, ‘detail’: None, ‘actions’: {}, ‘message’: u’Method not allowed’, ‘type’: u’error’, ‘id’: u’57471924-de89-4683-b889-13ff4b052b3d’}

Method not allowed ???
What shoud I do if I want to delete an account by using CLI

Accounts have to be deactivated before they can be deleted:

gdapi account-deactivate --id=1a3271

1 Like

thanks, @vincent
I did use ‘deactivate’ before.
gdapi account-deactivate --id=1a3274 && gdapi delete-account --id=1a3274

But between “deactivate” and “delete”, I have to use “sleep”.
gdapi account-deactivate --id=1a3274 && sleep 2 && gdapi delete-account --id=1a3274
It will take time to change the ‘state’ value.

Yes, ideally we would have a --wait-for-it type flag to wait for transitions to finish, but that doesn’t exist today. Sleep will work-ish, or you can poll the state if you want it to really work consistently.