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

[CON-689] issue 1308 Elasticsearch 5 Support Will Break External Solr #1309

Merged
merged 2 commits into from
Jun 16, 2017

Conversation

lancewf
Copy link
Contributor

@lancewf lancewf commented Jun 16, 2017

Signed-off-by: Lance Finfrock [email protected]

#1308

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Signed-off-by: Lance Finfrock <[email protected]>
Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

👍

version = JSON.parse(res.body)['version']['number'].split('.').first.to_i
raise "Unsupported elasticsearch version of #{version}. There is current support for the major versions of 2 and 5." if version != 5 && version != 2
version
rescue => e
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] Can we say StandardError here?

Copy link
Contributor

Choose a reason for hiding this comment

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

It also seems really odd that we raise inside of a begin/rescue block...

Choose a reason for hiding this comment

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

It was attempting to decorate the JSON exceptions with more context. I restructured it to be more explicit.

version = JSON.parse(res.body)['version']['number'].split('.').first.to_i
raise "Unsupported elasticsearch version of #{version}. There is current support for the major versions of 2 and 5." if version != 5 && version != 2
version
rescue => e
Copy link
Contributor

Choose a reason for hiding this comment

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

It also seems really odd that we raise inside of a begin/rescue block...

raise "Unsupported elasticsearch version of #{version}. There is current support for the major versions of 2 and 5." if version != 5 && version != 2
version
begin
version = JSON.parse(res.body)['version']['number'].split('.').first.to_i
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't appear that we're testing the raise here when we get no data, but maybe that's for another change?

Choose a reason for hiding this comment

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

Added

@sdelano
Copy link
Contributor

sdelano commented Jun 16, 2017

Thank you so much for adding tests here around external services. This is awesome!

@@ -104,6 +105,16 @@ Vagrant.configure("2") do |config|
attributes['vm']['elasticsearch'] = nil
end

if attributes['vm'].has_key? 'external_solr'
if attributes['vm']['external_solr']['start'] == true
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a bit more idiomatic ruby written like:

if attributes['vm']['external_solr'] && attributes['vm']['external_solr']['start']

Choose a reason for hiding this comment

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

It totally makes sense... but for whatever reason all the other attributes['vm'] clauses use this strange pattern. It might just be copy-pasta, but I it'd be better to just fix them all up in another pass. Some of this (the chef_backend stuff assigning nil but then reading an attribute underneath it later) doesn't even seem quite right but those codepaths may never ever get used. I might simplify it a bunch.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is definitely not a blocker. 👍

Signed-off-by: Kartik Null Cating-Subramanian <[email protected]>
Copy link

@elliott-davis elliott-davis left a comment

Choose a reason for hiding this comment

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

"opscode_erchef['search_provider']" => '"solr"',
"opscode_erchef['search_queue_mode']" => '"batch"'
}
json = simple_deep_merge(json, { "provisioning" => { "chef-server-config" => external_solr } })

Choose a reason for hiding this comment

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

I sort of hope there is a complex_deep_merge somewhere

@lancewf lancewf merged commit eb308ad into master Jun 16, 2017
@stevendanna stevendanna deleted the lancewf/CON-689 branch July 20, 2017 07:41
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.

None yet

7 participants