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

elasticsearch resource #1956

Closed
wants to merge 27 commits into from

Conversation

rx294
Copy link
Contributor

@rx294 rx294 commented Jun 22, 2017

Documentation and Unit Tests

Signed-off-by: Rony Xavier [email protected]
Signed-off-by: Aaron Lippold [email protected]

@rx294 rx294 force-pushed the al/elasticsearch_resource branch from 5fbbbc3 to 12003d7 Compare June 22, 2017 22:58
@aaronlippold aaronlippold force-pushed the al/elasticsearch_resource branch 3 times, most recently from 5b16a2a to 5ed9d31 Compare June 23, 2017 03:19
Signed-off-by: Rony Xavier <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
@aaronlippold aaronlippold force-pushed the al/elasticsearch_resource branch from 5ed9d31 to 1530818 Compare June 23, 2017 03:40
Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

Hi, @rx294 - welcome to the InSpec community and thanks for your first PR!

I've left you some feedback - please don't hesitate to ask if you have any questions. Thanks!

* `{ should eq 'value' }` is the value that is expected

## Supported Properties
* `'cluster_name'`, `'node_id'`, `'node_name'`,`'host'`, `'ip'`, `'version'`, `'build_hash'`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just make each item a single bullet item, alphabetized? Makes it easier to read through and easier for a user to find what they're looking for.

### cluster_name ([String])

describe elasticsearch.where { node_name == 'package-centos-72' } do
its('cluster_name.first') { should match 'elasticsearch' }
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the cmp matcher will change a single-element array to a non-array, I'd change this to:

its('cluster_name') { should cmp 'elasticsearch' }

# Verify the version of the node that matches the name node2

describe elasticsearch.where { node_name == 'package-centos-72' } do
its('version.first') { should match '5.4.1' }
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, I'd use the cmp matcher here rather than teaching users to use first

@@ -90,6 +90,7 @@ def self.validate_resource_dsl_version!(version)
require 'resources/docker_image'
require 'resources/docker_container'
require 'resources/etc_group'
require 'resources/elasticsearch.rb'
Copy link
Contributor

Choose a reason for hiding this comment

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

You can drop the .rb from this

module Inspec::Resources
class Elasticsearch < Inspec.resource(1)
name 'elasticsearch'
desc 'See Description below'
Copy link
Contributor

Choose a reason for hiding this comment

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

The desc contents are displayed in the inspec shell output... so there would be no description printed. Please uncomment similar to other resources.


def parse_node_process(node)
{
'process' => node,
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 cause the node hash to have a full copy of itself. Did you forget to set a key here?

end

def to_s
'Elasticsearch Environment'
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 Environment is a loaded term... how about Elasticsearch ClusterInfo?

www/Gemfile.lock Outdated
@@ -1,275 +0,0 @@
PATH
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please revert this change from your commit? The Gemfile.lock for the www should remain, and if there is a desire to drop it, we should do that as a separate PR. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @adamleff, I have reorganized and made the recommended changes to this PR. I belive I have reverted the Gemfile.lock, please let me know if it has not been reverted.
Please review it when you get a chance. Thank you

_(resource.version).must_equal ["5.4.1"]
end

it 'Verify elasticsearch node mlockall state' do
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation lines 16-34 is off.. should be in line with the block above in lines 11-14.

require 'inspec/resource'

describe 'Inspec::Resources::Elasticsearch' do
describe 'elasticsearch' do
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like a duplicative describe block... can we remove this?

# copyright: 2017
# author: Rony Xavier, [email protected]
# author: Aaron Lippold, [email protected]
# license: All rights reserved
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this line. InSpec is released under Apache 2.0. We have a pending PR to remove this line from all our files (acknowledging that you probably copy/pasted this from another existing file 🙂 ).

# encoding: utf-8
# copyright: 2017
# author: Rony Xavier, [email protected]
# license: All rights reserved
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this line. InSpec is released under Apache 2.0. We have a pending PR to remove this line from all our files (acknowledging that you probably copy/pasted this from another existing file 🙂 ).

@adamleff adamleff added the Type: New Feature Adds new functionality label Jun 27, 2017
@adamleff
Copy link
Contributor

@rx294 just a heads up on this PR, it now has merge conflicts. Be sure to rebase your branch on the latest master and address those issues. One is on www/Gemfile.lock which you should just pull out of your commit since your PR shouldn't touch that file. :)

Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

@rx294 I may not have cycles to give this a thorough review until I return from my vacation, but perhaps the other maintainers might.

However, right out of the gate, I notice that your change still deletes the Gemfile.lock file and adds it to the .gitignore file. Neither of these changes can be accepted in this PR.

@rx294 rx294 force-pushed the al/elasticsearch_resource branch from 7e7e0fb to 0a4e5b9 Compare July 15, 2017 01:52
Signed-off-by: Rony Xavier <[email protected]>
@rx294 rx294 force-pushed the al/elasticsearch_resource branch from 0a4e5b9 to 848d595 Compare July 15, 2017 01:56
@aaronlippold aaronlippold force-pushed the al/elasticsearch_resource branch from 01c73b7 to efe96e6 Compare July 18, 2017 16:56
Signed-off-by: Rony Xavier <[email protected]>
@rx294 rx294 changed the title Initial commit of elasticsearch resource, elasticsearch resource Jul 25, 2017
@rx294 rx294 force-pushed the al/elasticsearch_resource branch from b63aed7 to 7112051 Compare July 29, 2017 23:53
Signed-off-by: Rony Xavier <[email protected]>
@rx294 rx294 force-pushed the al/elasticsearch_resource branch from 7112051 to 8d206b2 Compare August 7, 2017 14:21
Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

Great work, let's just tidy this up!

class Elasticsearch < Inspec.resource(1)
name 'elasticsearch'
desc "Use the Elasticsearch InSpec audit resource to test the Elasticsearch
configuration settings. The data is extract from the live elastic search
Copy link
Contributor

Choose a reason for hiding this comment

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

Lines 51-53, please indent 2 spaces

its('name') { should_not include 'node_name' }
end
elasticsearch.nodes.os.each do |nodeos|
describe nodeos do
Copy link
Contributor

Choose a reason for hiding this comment

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

66-68, needs one more space

end
end
elasticsearch.nodes.version.each do |node_version|
describe node_version do
Copy link
Contributor

Choose a reason for hiding this comment

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

71-73, fix indentation, and please git rid of that pesky tab on line 72 :)

its('path.conf') {should cmp '/etc/elasticsearch'}
end
end
elasticsearch.nodes.where{name == 'package-centos-72' }.settings.each do |node_settings|
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 80 - more tabs! You're killing me... slowly... 🙂

"

def initialize(url = 'http://localhost:9200/_nodes/')
return skip_resource 'Package `curl` not avaiable on the host' unless inspec.package('curl').installed?
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to:

unless inspec.command('curl').exist?

if command.stderr =~ /Failed to connect/
return skip_resource 'Connection refused please check ip and port provided'
end
@content = JSON.parse(command.stdout)
Copy link
Contributor

Choose a reason for hiding this comment

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

Protect against a failed JSON parse to avoid a Ruby exception unwinding the whole InSpec run.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this, and the few lines that follow, should be broken out into a helper method.

def initialize
  # blah blah
  @content = read_es_data(url)
end

def read_es_data(url)
  # call curl
  # handle error, skip_resource if curl fails
  @content = JSON.parse(curl_output)
rescue JSON::ParserError => e
  skip_resource "Couldn't parse ES data: #{e.message}"
end

node.node_id = node_id
node.plugin_list = plugin_list(node)
node.module_list = module_list(node)
node.cluster = node.settings.cluster.name
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion to think about, should this be cluster_name?

And for sake of clarity, I would set this from node_data vs. setting it from itself...

node.cluster_name = node_data['settings']['cluster']['name']

node.cluster = node.settings.cluster.name
@nodes.push(node)
end
rescue JSON::ParserError => _e
Copy link
Contributor

Choose a reason for hiding this comment

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

rescue JSON::ParserError

@nodes.push(node)
end
rescue JSON::ParserError => _e
return Hashie::Mash.new({})
Copy link
Contributor

Choose a reason for hiding this comment

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

Hashie::Mash.new

def plugin_list(node)
plugins_list = []
node.plugins.each do |plugins|
plugins_list.push(plugins.name)
Copy link
Contributor

Choose a reason for hiding this comment

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

plugins_list << plugins.name

Copy link
Contributor

Choose a reason for hiding this comment

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

For your education only :)

@aaronlippold aaronlippold force-pushed the al/elasticsearch_resource branch from 8d206b2 to b63aed7 Compare August 9, 2017 12:40
@rx294
Copy link
Contributor Author

rx294 commented Aug 15, 2017

@adamleff hey Adam this PR is ready...although looks like one of the Travis tests are failing for an unrelated issue. Thank you

def read_es_data(url)
cmd = inspec.command("curl #{url}")
if !cmd.exit_status.zero?
return skip_resource "Error using the curl #{url}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps as a follow-up to this PR, I'd suggest adding the stderr from the command to this message in hopes that it will help the user troubleshoot:

return skip_resource "Error fetching Elastcsearch data from #{url}: #{cmd.stderr}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @adamleff that makes more sense.

Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

@rx294 this looks good, just one thing that we need to clean up in the read_es_data method re: error handling. I don't think we'll ever get to one of your error handling steps because of the way the method is written.

if !cmd.exit_status.zero?
return skip_resource "Error using the curl #{url}"
end
if cmd.stderr =~ /Failed to connect/
Copy link
Contributor

Choose a reason for hiding this comment

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

If curl fails, it will catch at line 97 above and then we'll return. I don't think you'll ever get to this part of your method if it failed to connect.

If you want to provide a specific "connection refused" skip message, you will likely need to move lines 100-102 above line 97, and let the if statement at line 97 be a "catch-all error except connection refused events" handler. Make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the catch. That makes sense.

Signed-off-by: Rony Xavier <[email protected]>
@rx294
Copy link
Contributor Author

rx294 commented Aug 20, 2017

@adamleff I am getting a travisci error as below:

example inheritance profile#test_0004_ensure json/check command do not fetch remote profiles if vendored [/home/travis/build/chef/inspec/test/functional/inspec_vendor_test.rb:61]:

It looks unrelated to the elasticsearch resource, please let me know if it is not.

Thank you

Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

Super-close, @rx294 -- just some doc fixes and a discussion about the default URL. Thanks!

end
elasticsearch.nodes.os.each do |nodeos|
describe nodeos do
its('name'){ should_not cmp 'MacOS' }
Copy link
Contributor

Choose a reason for hiding this comment

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

Need space between ) and {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

cluster using the curl command `curl localhost:9200/_nodes/`. The resource
makes uses of FilterTable and its functionality can be used "

example "
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a newline between each describe block so it's clearer and consistent with other documentation? Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

end
elasticsearch.nodes.version.each do |node_version|
describe node_version do
it{ should be > '1.2.0' }
Copy link
Contributor

Choose a reason for hiding this comment

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

Space needed between it and {

it{ should be > '1.2.0' }
end
end
elasticsearch.nodes.where{os.name == 'Linux' }.settings.each do |node_settings|
Copy link
Contributor

Choose a reason for hiding this comment

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

Space needed between where and {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

end
elasticsearch.nodes.where{os.name == 'Linux' }.settings.each do |node_settings|
describe node_settings do
its('path.conf') {should cmp '/etc/elasticsearch'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add wrapper spaces within the braces...

{ should cmp '/etc/elasticsearch' }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

end
elasticsearch.nodes.where{name == 'package-centos-72' }.settings.each do |node_settings|
describe node_settings do
its('path.conf') {should cmp '/etc/elasticsearch'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add wrapper spaces within the braces...

{ should cmp '/etc/elasticsearch' }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thank you @adamleff , I should have known better by now haha

end
"

def initialize(url = 'http://localhost:9200/_nodes/')
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to include the _nodes part here? I think perhaps this should be the base URL for wherever Elasticsearch lives, and then we can call /_nodes within the resource. That way if we want to hit other endpoints later, such as /_cluster/health, we don't have to rework this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The _nodes part is important because it exposes all the settings we are exposing using the resource and our parsers are expecting the json structure the '_nodes' curl request returns.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rx294 that's exactly my point. Your resource depends on hitting /_nodes to do its job, but that is not the top-level URL to an Elasticsearch node/cluster. You are shifting an implementation detail responsibility onto the consumer of your resource.

You should ask expect the user to give you the top-level URL to their cluster, and then you as the resource author should tack on the /_nodes endpoint to the URL before you start making curl calls. Otherwise, you are forcing users to know that detail... and in the future, if we need to retrieve data from different endpoints (such as /_cluster or /_cat, we don't have to do janky regsub or break backward compatibility.

_(node_roles).must_include 'master'
end
end
resource_with_url = load_resource('elasticsearch','http://localhost:9200/_nodes/')
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's test with a non-default URL. This really isn't testing anything other than our ability to pass in a second argument. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: Rony Xavier <[email protected]>
@@ -32,7 +32,7 @@
_(node_roles).must_include 'master'
end
end
resource_with_url = load_resource('elasticsearch','http://localhost:9200/_nodes/')
resource_with_url = load_resource('elasticsearch','http://localhost:9200/_nodes/ -u es_admin:password')
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 not what I meant... that's not part of the URL, that's now a command flag you pass to curl, but in the future, this resource may use a different method of fetching an HTTP endpoint.

It's possible to have elasticsearch clusters on different hostnames and different URIs. For example:

http://mydatacenter.mycompany.biz/myelasticsearch

... in which case, your resource would fetch from http://mydatacenter.mycompany.biz/myelasticsearch/_nodes

@adamleff
Copy link
Contributor

adamleff commented Sep 7, 2017

Status as I see it today: my concern about the user needing to supply /_nodes in their URL still needs to be addressed as does my concern about the way we're testing a non-standard URL. This is not yet ready to be re-reviewed.

@rx294
Copy link
Contributor Author

rx294 commented Oct 2, 2017

Hey @adamleff . I have made the updates. Please review it when you get a chance. Thank you!

Signed-off-by: Rony Xavier <[email protected]>
Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

@rx294 I only looked at it briefly, and this is closer, but I believe you made a decision that will hinder some users' ability to use it.

Specifically, you eliminated passing a URL and instead opted for parameters es_host and es_port. This means users to have Elasticsearch installed on a machine with a non-root URI (i.e. http://myhost:9201/elasticsearch) will not be able to use this resource. We should really go back to using URIs instead of parameterizing the host and port

Also, we should use better parameter names - there is no need to use the es_ prefix since the parameters are specific to this resource. Let's try to use clear and easy-to-understand parameter names.


* `es_ip` elasticsearch ip address, default : 0.0.0.0
* `es_port` elasticsearch port address, default : 9200
* `es_user` elasticsearch user name, default : nil
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to prefix with es_ - use username

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* `es_ip` elasticsearch ip address, default : 0.0.0.0
* `es_port` elasticsearch port address, default : 9200
* `es_user` elasticsearch user name, default : nil
* `es_pass` elasticsearch user password, default : nil
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to prefix with es_ - use password

* `es_port` elasticsearch port address, default : 9200
* `es_user` elasticsearch user name, default : nil
* `es_pass` elasticsearch user password, default : nil
* `https(bool)` elasticsearch connection protocol, default : true
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to have this as a parameter - just accept a full URI to the elasticsearch top-level

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* `es_user` elasticsearch user name, default : nil
* `es_pass` elasticsearch user password, default : nil
* `https(bool)` elasticsearch connection protocol, default : true
* `self_signed_cert(bool)` elasticsearch uses self-signed certificate , default : false
Copy link
Contributor

Choose a reason for hiding this comment

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

There are more reasons you need to disable SSL certificate validation other than a self-signed cert is in use. For consistency with other resources, please name this ssl_verify and you can default to true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


where

* `es_ip` elasticsearch ip address, default : 0.0.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

We should accept a URI and not an IP/port - see my top-level review comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Done.

return skip_resource "Couldn't parse ES data: #{e.message}"
end

return skip_resource "Security Exception: #{@content['error']}" unless @content['error'].nil?
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain this? What's a "security exception"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have modified it to show status of the error from elasticsearch


cmd = inspec.command("curl #{url}")
return skip_resource 'Connection refused please check ip and port provided' if cmd.stderr =~ /Failed to connect/
return skip_resource "Connection refused Peer's Certificate issuer is not recognized" if cmd.stderr =~ /Peer's Certificate issuer is not recognized/
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? The stderr will be displayed in the skip_resource message in line 112.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would help capture the reason of failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but the reason for the failure you're matching on ("Peer's Certificate issue is not recognized") is in the stderr output already, and it will be output in line 112. The skip message you're returning in this line 111 is not adding any additional value that wouldn't be handled properly in line 112.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh i remmember, the Peer certificate stderr is this big ugly block
"% Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (60) Peer's Certificate issuer is not recognized.\nMore details here: http://curl.haxx.se/docs/sslcerts.html\n\ncurl performs SSL certificate verification by default, using a "bundle"\n of Certificate Authority (CA) public keys (CA certs). If the default\n bundle file isn't adequate, you can specify an alternate file\n using the --cacert option.\nIf this HTTPS server uses a certificate signed by a CA represented in\n the bundle, the certificate verification probably failed due to a\n problem with the certificate (it might be expired, or the name might\n not match the domain name in the URL).\nIf you'd like to turn off curl's verification of the certificate, use\n the -k (or --insecure) option.\n"

I figured this would be a cleaner skip message of a known possible error.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a great reason. Let's add a comment above this line that explains why we're specifically catching this one error type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

rx294 added 5 commits October 9, 2017 10:09
Signed-off-by: Rony Xavier <[email protected]>
Signed-off-by: Rony Xavier <[email protected]>
Signed-off-by: Rony Xavier <[email protected]>
Signed-off-by: Rony Xavier <[email protected]>
Signed-off-by: Rony Xavier <[email protected]>
@adamleff
Copy link
Contributor

@rx294 I still think there are some issues with this that I've unsuccessfully tried to communicate (i.e. the URL should be an argument rather than an item in the option hash), and there are still issues (i.e. the default URL shouldn't use 0.0.0.0 or https by default), so I'm going to adopt your PR with attribution and try and push it across the finish line. I'm traveling for the next couple of days, so I should be able to work on this sometime next week. Unfortunately, it's just taking too much time to try and address the remaining issues through the PR back-and-forth process.

I'll close this PR with an new updated one once I've done so. Thanks.

@rx294
Copy link
Contributor Author

rx294 commented Oct 13, 2017

Got it. thank you adam

adamleff pushed a commit that referenced this pull request Oct 20, 2017
This is a new resource for testing an Elasticsearch cluster. It operates
by fetching the `_nodes` endpoint from a given Elasticsearch node and
collects data about each node in a cluster, even if there's only a
single node.

This work is based on inspiration from an initial PR #1956 submitted by
@rx294.

Signed-off-by: Rony Xavier <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
Signed-off-by: Adam Leff <[email protected]>
@adamleff
Copy link
Contributor

Superseded by PR #2261 - thanks for your work on this.

@adamleff adamleff closed this Oct 20, 2017
adamleff added a commit that referenced this pull request Oct 20, 2017
* new resource: elasticsearch resource, test cluster/node state

This is a new resource for testing an Elasticsearch cluster. It operates
by fetching the `_nodes` endpoint from a given Elasticsearch node and
collects data about each node in a cluster, even if there's only a
single node.

This work is based on inspiration from an initial PR #1956 submitted by
@rx294.

Signed-off-by: Rony Xavier <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
Signed-off-by: Adam Leff <[email protected]>

* Reduce mock data on non-default tests

Signed-off-by: Adam Leff <[email protected]>
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