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

Update pooler provider to throw an exception if the API returns non-OK #55

Merged
merged 1 commit into from
Dec 5, 2019
Merged

Update pooler provider to throw an exception if the API returns non-OK #55

merged 1 commit into from
Dec 5, 2019

Conversation

highb
Copy link
Contributor

@highb highb commented Dec 4, 2019

Prior to this commit the API could fail and return ok: false but
floaty wouldn't recognize that as a failure.
This commit updates the pooler code to check for ok and raise and
error with the body of what the api returns if it's non-truthy.

@highb
Copy link
Contributor Author

highb commented Dec 4, 2019

Here's what it looks like:

➜  vmfloaty git:(master) ✗ be bin/floaty modify jovial-athlete.delivery.puppetlabs.net --service vmlocal --lifetime 101
HTTP 400: Failed to modify VMs from the pooler vm/jovial-athlete.delivery.puppetlabs.net. {"ok"=>false, "failures"=>["You provided a lifetime (101) that exceeds the configured maximum of 100.", "You provided a lifetime (101) that will extend the current lifetime past the configured maximum of 100."]}
➜  vmfloaty git:(master) ✗ be bin/floaty modify jovial-athlete.delivery.puppetlabs.net --service vmlocal --lifetime 100
HTTP 400: Failed to modify VMs from the pooler vm/jovial-athlete.delivery.puppetlabs.net. {"ok"=>false, "failures"=>["You provided a lifetime (100) that exceeds the configured maximum of 100.", "You provided a lifetime (100) that will extend the current lifetime past the configured maximum of 100."]}
➜  vmfloaty git:(master) ✗ be bin/floaty modify jovial-athlete.delivery.puppetlabs.net --service vmlocal --lifetime 99
{"jovial-athlete.delivery.puppetlabs.net"=>{"ok"=>true}}
Successfully modified VM jovial-athlete.delivery.puppetlabs.net.
Use `floaty list --active` to see the results.

sbeaulie
sbeaulie previously approved these changes Dec 4, 2019
@highb
Copy link
Contributor Author

highb commented Dec 5, 2019

@briancain Hey could you approve/merge this? Apparently I can't self-merge. :D

Prior to this commit the API could fail and return `ok: false` but
floaty wouldn't recognize that as a failure.
This commit updates the pooler code to check for `ok` and raise and
error with the body of what the api returns if it's non-truthy.
Copy link
Contributor

@briancain briancain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@briancain briancain merged commit 7d0a725 into puppetlabs:master Dec 5, 2019
@briancain
Copy link
Contributor

Done!

@highb
Copy link
Contributor Author

highb commented Dec 5, 2019

Yay thanks!

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

Successfully merging this pull request may close these issues.

3 participants