lib/elasticsearch/extensions/test/cluster.rb in elasticsearch-extensions-0.0.32 vs lib/elasticsearch/extensions/test/cluster.rb in elasticsearch-extensions-0.0.33
- old
+ new
@@ -203,11 +203,11 @@
-E network.host=#{arguments[:network_host]} \
-E node.attr.testattr=test \
-E path.repo=/tmp \
-E repositories.url.allowed_urls=http://snapshot.test* \
-E discovery.zen.minimum_master_nodes=#{arguments[:number_of_nodes]-1} \
- -E xpack.security.enabled=false \
+ #{'-E xpack.security.enabled=false' unless arguments[:dist] == 'oss'} \
-E node.max_local_storage_nodes=#{arguments[:number_of_nodes]} \
-E logger.level=#{ENV['DEBUG'] ? 'DEBUG' : 'INFO'} \
#{arguments[:es_params]}
COMMAND
}
@@ -470,11 +470,10 @@
#
# @return String
#
def __determine_version
path_to_lib = File.dirname(arguments[:command]) + '/../lib/'
-
version = if arguments[:version]
arguments[:version]
elsif File.exist?(path_to_lib) && !(jar = Dir.entries(path_to_lib).select { |f| f =~ /^elasticsearch\-\d/ }.first).nil?
__log "Determining version from [#{jar}]" if ENV['DEBUG']
if m = jar.match(/elasticsearch\-(\d+\.\d+\.\d+).*/)
@@ -528,10 +527,12 @@
if output.empty?
raise RuntimeError, "Cannot determine Elasticsearch version from [#{arguments[:command]} --version] or [#{arguments[:command]} -v]"
end
+ @dist = output.match(/Build: ([a-z]+)\//)&.[](1)
+
if(m = output.match(/Version: (\d+\.\d+.\d+).*,/))
m[1]
else
raise RuntimeError, "Cannot determine Elasticsearch version from elasticsearch --version output [#{output}]"
end
@@ -562,15 +563,14 @@
# @api private
#
# @return String
#
def __command(version, arguments, node_number)
- if command = COMMANDS[version]
- command.call(arguments, node_number)
- else
- raise ArgumentError, "Cannot find command for version [#{version}]"
- end
+ raise ArgumentError, "Cannot find command for version [#{version}]" unless (command = COMMANDS[version])
+
+ arguments.merge!({ dist: @dist })
+ command.call(arguments, node_number)
end
# Blocks the process and waits for the cluster to be in a "green" state
#
# Prints information about the cluster on STDOUT if the cluster is available.
@@ -667,10 +667,9 @@
# @api private
#
def __remove_cluster_data
FileUtils.rm_rf arguments[:path_data]
end
-
# Check whether process for PIDs are running
#
# @api private
#