Module: Chef::Knife::LparBase

Included in:
LparCreate, LparDelete, LparList
Defined in:
lib/chef/knife/lpar_base.rb

Instance Method Summary collapse

Instance Method Details

#get_passwordObject

quick and dirty password prompt, because I’m cool like that



50
51
52
53
# File 'lib/chef/knife/lpar_base.rb', line 50

def get_password
  print "Enter root password for HMC: "
  STDIN.noecho(&:gets).chomp
end

I hate this name but I’m not thinking of anything better right now.



26
27
28
29
30
31
32
# File 'lib/chef/knife/lpar_base.rb', line 26

def print_with_output(message, output = nil)
  if output.nil? || output.empty?
    ui.info message
  else
    ui.info message + " - " + output
  end
end

#run_remote_command(ssh, command) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/chef/knife/lpar_base.rb', line 34

def run_remote_command(ssh, command)
  return_val = nil
  ssh.exec! command do |ch, stream, data|
    if stream == :stdout
      return_val = data.chomp
    else
      # some exception is in order I think
      ui.error "Something went wrong:"
      ui.error data.to_s
      exit 1
    end
  end
  return_val
end