Class: ElasticsearchUpdate::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/elasticsearch_update/cli.rb

Overview

CLI

ElasticsearchUpdate::Cli class is used to begin application execution and walks the user through the update process

Parameters

Start takes no parameters or options.

Instance Method Summary collapse

Constructor Details

#initializeCli

Start the command line update process which calls all necessary methods and classes to complete an Elasticsearch update.

Example

ElasticsearchUpdate::Cli.new


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/elasticsearch_update/cli.rb', line 18

def initialize
  @log = Logger.new(STDOUT)
  @log.level = Logger::INFO

  @log.debug('Logger created for CLI.')

  wizard = Wizard.new

  es_client = Elasticsearch.new wizard.es_location_hash
  es_client.cluster_routing_allocation('none')
  es_client.shutdown_local_node

  downloader = Downloader.new(wizard.download_hash)
  file = downloader.download_file
  downloader.verify_update_file

  installer = Installer.new(wizard.sudo_password,
                            downloader.extension)
  installer.install_file(file)

  es_client.start_elasticsearch(installer)
  @log.info('Waiting for Elasticsearch to start.')
  sleep 10
  es_client.cluster_routing_allocation('all')
end