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

Stop using deprecated names of hawkular-client gem #14543

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Stop using deprecated names of hawkular-client gem.
Version 2.9.0 of hawkular-client has deprecated some names. This is
replacing the deprecated names with the current ones.
  • Loading branch information
israel-hdez committed Mar 28, 2017
commit 71a7d668b9b5a88aec3e460efa46949d2d450197
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ def self.raw_connect(options)
when :metrics
::Hawkular::Metrics::Client
when :alerts
::Hawkular::Alerts::AlertsClient
::Hawkular::Alerts::Client
else
raise ArgumentError, "Client not found for [#{type}]"
end
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ class Hawkular::MiddlewareManager < ManageIQ::Providers::MiddlewareManager
require_nested :Refresher

include AuthenticationMixin
include ::HawkularUtilsMixin
include ::Hawkular::ClientUtils

DEFAULT_PORT = 80
default_value_for :port, DEFAULT_PORT
@@ -279,7 +279,7 @@ def self.raw_alerts_connect(hostname, port, username, password)
:username => username,
:password => password
}
::Hawkular::Alerts::AlertsClient.new(url, credentials)
::Hawkular::Alerts::Client.new(url, credentials)

Choose a reason for hiding this comment

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

Can you have a problem in middleware since you are not setting the tenant explicitly?

I'm referring to:
https://github.com/hawkular/hawkular-client-ruby/blob/master/api_breaking_changes.rdoc#200

Copy link
Member

Choose a reason for hiding this comment

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

good point, @Jiri-Kremser and @lucasponce can you please reply?

Copy link
Member

Choose a reason for hiding this comment

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

If the code worked before, this change shouldn't break it. Nor the version bump to 2.9.0 @lucasponce it works because alerts don't enforce the hawkular tenant header, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Jiri-Kremser yes, the Alerts client expects the tenant from the options, the default 'hawkular' tenant used by Middleware is set in the upper raw_client as far as I remember. Inside the Alerts rb there is not tenant manipulation.

Choose a reason for hiding this comment

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

@lucasponce I'm not sure I'm seeing it set:

def self.raw_alerts_connect(hostname, port, username, password)

Copy link
Member

Choose a reason for hiding this comment

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

ok, so the alerts server side does require the header being set:

$curl -s -u jdoe:password 'http://localhost:8080/hawkular/alerts'
{"errorMsg":"The HTTP header Hawkular-Tenant has to be provided."}

So now I don't understand how this could have worked before.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that the AlertsClient is generated from the with_provider_connection which should invoke the connect()
https://github.com/israel-hdez/manageiq/blob/71a7d668b9b5a88aec3e460efa46949d2d450197/app/models/manageiq/providers/hawkular/middleware_manager.rb#L197
and invoke the raw_connect with the default tenant.
I did a grep and I can't see where raw_alerts_connect is invoked, perhaps it is on a separate PR just for the Datawarehouse use cases ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I also grep'ed managui-ui-classic repo and found no references to it.

Anyway... The code using raw_alerts_connect will fail with an exception because we have this: https://github.com/hawkular/hawkular-client-ruby/blob/master/lib/hawkular/base_client.rb#L32

I think it's dead code and I can safely remove it.

end

def add_middleware_datasource(ems_ref, hash)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ManageIQ::Providers
module Hawkular
class MiddlewareManager::RefreshParser
include ::HawkularUtilsMixin
include ::Hawkular::ClientUtils

def self.ems_inv_to_hashes(ems, options = nil)
new(ems, options).ems_inv_to_hashes