Class: Commands::PrintHiveVersionCommand
- Inherits:
-
AbstractSSHCommand
- Object
- Command
- AbstractSSHCommand
- Commands::PrintHiveVersionCommand
- Defined in:
- lib/commands.rb
Constant Summary
Constants inherited from AbstractSSHCommand
AbstractSSHCommand::CLOSED_DOWN_STATES, AbstractSSHCommand::WAITING_OR_RUNNING_STATES
Instance Attribute Summary
Attributes inherited from AbstractSSHCommand
#dest, #hostname, #jobflow_detail, #jobflow_id, #key_pair_file, #no_wait
Attributes inherited from Command
#arg, #commands, #description, #logger, #name
Instance Method Summary collapse
Methods inherited from AbstractSSHCommand
Methods inherited from Command
#get_field, #has_value, #have, #initialize, #option, #require, #require_single_jobflow, #resolve, #validate
Constructor Details
This class inherits a constructor from Commands::Command
Instance Method Details
#enact(client) ⇒ Object
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
# File 'lib/commands.rb', line 648 def enact(client) super(client) stdin, stdout, stderr = Open3.popen3("ssh -i #{key_pair_file} hadoop@#{hostname} '/home/hadoop/bin/hive -v'") version = stdout.readlines.join err = stderr.readlines.join if version.length > 0 puts version elsif err =~ /Unrecognised option/ or err =~ /Error while determing Hive version/ stdin, stdout, stderr = Open3.popen3("ssh -i #{key_pair_file} hadoop@#{hostname} 'ls -l /home/hadoop/bin/hive'") version = stdout.readlines.join version =~ /hive-(.*)\/bin\/hive/ puts "Hive version " + $1 else puts "Unable to determine Hive version" end end |