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

Give more information on a failed configuration validation. #17247

Merged
merged 1 commit into from
Apr 3, 2018

Conversation

Fryguy
Copy link
Member

@Fryguy Fryguy commented Apr 3, 2018

https://bugzilla.redhat.com/show_bug.cgi?id=1558031

@gtanzillo Please review

@abellotti This also gives you a proper exception class that you can rescue in the API side so that you can return a 400 error instead of a 500 error.

@Fryguy Fryguy added the bug label Apr 3, 2018
@Fryguy Fryguy added this to the Sprint 83 Ending Apr 9, 2018 milestone Apr 3, 2018
@Fryguy
Copy link
Member Author

Fryguy commented Apr 3, 2018

Before:

RuntimeError: configuration invalid

After

Vmdb::Settings::ConfigurationInvalid: authentication-mode: authentication mode, nil, is invalid. Should be one of: database, httpd, ldap, ldaps, amazon, none

@miq-bot
Copy link
Member

miq-bot commented Apr 3, 2018

Checked commit Fryguy@e089d49 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
5 files checked, 0 offenses detected
Everything looks fine. 🍰

@Fryguy
Copy link
Member Author

Fryguy commented Apr 3, 2018

Here's what it looks like with manageiq-api-client

[7] pry(main)> client.patch("servers/21000000000002/settings") { {"authentication" => {"bind_timeout" => 123 }} }
RuntimeError: authentication-mode: authentication mode, nil, is invalid. Should be one of: httpd, database, ldap, ldaps, amazon, none
from (manageiq-api-client-0.3.0) lib/manageiq/api/client/connection.rb:108:in `check_response'
(manageiq-api-client-0.3.0) lib/manageiq/api/client/connection.rb:102:in `send_request'
(manageiq-api-client-0.3.0) lib/manageiq/api/client/connection.rb:39:in `patch'
(manageiq-api-client-0.3.0) lib/manageiq/api/client/client.rb:65:in `patch'
(pry):7:in `<main>'

Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

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

👍

@gtanzillo gtanzillo merged commit 9e95f2b into ManageIQ:master Apr 3, 2018
@Fryguy Fryguy deleted the change_validator_exception branch April 9, 2018 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants