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

Bug on delete Account operation #69

Open
mtulio opened this issue Oct 22, 2020 · 2 comments
Open

Bug on delete Account operation #69

mtulio opened this issue Oct 22, 2020 · 2 comments

Comments

@mtulio
Copy link

mtulio commented Oct 22, 2020

There is a bug on arguments for delete account method delete_account. The method should accept account_name (means Name of the Account - as described on the method) but it accept only account_id.

The Error

respDelAcc = client.delete_account('MyAccountName')
---------------------------------------------------------------------------
SpotinstClientException                   Traceback (most recent call last)
<ipython-input-24-3f1331453d1c> in <module>
----> 1 respDelAcc = client.delete_account('MyAccountName')

/opt/conda/lib/python3.8/site-packages/spotinst_sdk/__init__.py in delete_account(self, account_name)
   1400         (Object): Spotinst API response
   1401         """
-> 1402         response = self.send_delete(
   1403             url=self.__base_setup_url +
   1404                 "/account/" + account_name,

/opt/conda/lib/python3.8/site-packages/spotinst_sdk/__init__.py in send_delete(self, url, entity_name)
   3554             return True
   3555         else:
-> 3556             self.handle_exception("deleting {}".format(entity_name), result)
   3557 
   3558     def send_delete_with_body(self, body, url, entity_name):

/opt/conda/lib/python3.8/site-packages/spotinst_sdk/__init__.py in handle_exception(self, action_string, result)
   3685         self.print_output(response_json)
   3686 
-> 3687         raise SpotinstClientException(
   3688             "Error encountered while " +
   3689             action_string,

SpotinstClientException: Error encountered while deleting account
{"status": {"code": 400, "message": "Bad Request"}, "errors": [{"code": "DELETION_FAILED", "message": "Account not found"}]}

When a account name is sent to the method, the API returns that the account was not found.

Success

When I sent the AccountId the API return success (True)

respDelAcc = client.delete_account('act-1234556')
@mtulio mtulio changed the title Bug on delete acccounts Bug on delete Account operation Oct 22, 2020
@Maycon-Santos-sm
Copy link

The same happened to me. It seems like the SDK and the API are not the focus of Spot.

@mtulio
Copy link
Author

mtulio commented Dec 11, 2020

The same happened to me. It seems like the SDK and the API are not the focus of Spot.

Yes, seems be!

There is an "desired" workflow that dont cover all cases, like why I need to create an session to manage accounts when I am using organization token?

I've created a PR #62 with suggestions.

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