-
Notifications
You must be signed in to change notification settings - Fork 62
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
Check metrics details from raw_connect
#134
Check metrics details from raw_connect
#134
Conversation
@pkliczewski @borod108 @masayag please review. Take into account that this pull request should be merged after #132. This currently contains two commits, the first is also in that other pull request. So please focus only in the second commit of this pull request. |
Note also that for this to work the UI has to be modified to send the required data. That is pull request ManageIQ/manageiq-ui-classic#2651. |
@jhernand This PR requires few changes in vcr files. For now the specs are failing. |
This pull request is not mergeable. Please rebase and repush. |
rescue StandardError => error | ||
raise adapt_metrics_error(error) | ||
ensure | ||
OvirtMetrics.disconnect rescue nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems that rubocop would prefer
begin
OvirtMetrics.disconnect
rescue
nil
end
but we have the same style in line 145
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do as Rubocop says.
@miq-bot add_label gaprindashvili/yes |
# @options opts [String] :metrics_database The name of the metrics database. | ||
# @return [Boolean] Returns `true` if the connection details and credentials are valid, or `false` otherwise. | ||
# | ||
def raw_connect(opts = {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there anyway we can rename this to something with "validate?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is the name that the UI uses, it has to be raw_connect
.
# | ||
def raw_connect(opts = {}) | ||
check_connect_api(opts) | ||
check_connect_metrics(opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we checking both of these? how do we know which one failed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check all the details that the user gives in the UI, if I understand correctly. We won't know what failed, nor do we need: the human user will know, hopefully, using her eyes and brain.
Currently the `raw_connect` doesn't check the metrics connection details. This patch adds that check. This patch fixes partially the following bug: Failed validation when adding RHV provider https://bugzilla.redhat.com/1509432
Checked commit https://github.com/jhernand/manageiq-providers-ovirt/commit/1a6e4dc50f1c4644f065ebdc613c277fd1579680 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 |
Well yes, we can safely assume the user has eyes and brain :) So using his
eyes and brain, will he be able to see which if the credentials fail? I
mean we have it in two tabs, and the validation button from the code here
looks like it sends the info from both, does it show in which tab the
failure is?
Its a UI question, I know, I am just wondering because I seem to remember
it did not work so well.
Any way I am for merging, just wondering...
…On Tue, Nov 7, 2017 at 6:04 PM, Juan Hernández ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/models/manageiq/providers/redhat/infra_manager/api_integration.rb
<#134 (comment)>
:
> + # @option opts [Integer] :port ('443') The port number of the API server.
+ # @option opts [Integer] :verify_ssl ('1') A numeric flag indicating if the TLS certificates of the API server
+ # should be checked. Value `0` indicates that the should not be checked, value `1` indicates that they should
+ # be checked.
+ # @option opts [String] :ca_certs The custom trusted CA certificates used to check the TLS certificates of the
+ # API server, in PEM format. A blank or nil value means that no custom CA certificates should be used.
+ # @option opts [String] :metrics_userid The name of the metrics database user.
+ # @option opts [String] :metrics_password The password of the metrics database user.
+ # @options opts [String] :metrics_server The host name or IP address of the metrics database server.
+ # @options opts [Integer] :metrics_port ('5432') The port number of the metrics database server.
+ # @options opts [String] :metrics_database The name of the metrics database.
+ # @return [Boolean] Returns `true` if the connection details and credentials are valid, or `false` otherwise.
+ #
+ def raw_connect(opts = {})
+ check_connect_api(opts)
+ check_connect_metrics(opts)
We need to check all the details that the user gives in the UI, if I
understand correctly. We won't know what failed, nor do we need: the human
user will know, hopefully, using her eyes and brain.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#134 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADH365fNgzz3TlO9l5MGbcGgl5jWo63Xks5s0H-EgaJpZM4QUtD5>
.
|
@borod108 in my tests the error messages displayed to the user were very informative, and it was easy to determine what was wrong. There is certainly room for improvement, but I really don't want to mix those improvements with fixing the main issue. |
The tests are failing with this error:
I think that isn't related to this change, but rather to ManageIQ/manageiq#16405. @Ladas @agrare @pkliczewski can you take a look. I think that the reason is that the above pull request assumes that all targeted objects have a |
The fix for the issue that caused the test failure (ManageIQ/manageiq#16411) has been merged. I am closing and re-opening this to re-run the tests. |
…_connect Check metrics details from `raw_connect` (cherry picked from commit af9c776) https://bugzilla.redhat.com/show_bug.cgi?id=1511079
Gaprindashvili backport details:
|
Currently the
raw_connect
doesn't check the metrics connectiondetails. This patch adds that check.
This patch fixes partially the following bug:
RHV provider metrics validation is broken
https://bugzilla.redhat.com/1510533