Module: Specinfra::Configuration

Defined in:
lib/itamae/backend.rb

Class Method Summary collapse

Class Method Details

.sudo_passwordObject


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/itamae/backend.rb', line 7

def self.sudo_password
  return ENV['SUDO_PASSWORD'] if ENV['SUDO_PASSWORD']
  return @sudo_password if @sudo_password

  # TODO: Fix this dirty hack
  return nil unless caller.any? {|call| call.include?('channel_data') }

  print "sudo password: "
  @sudo_password = STDIN.noecho(&:gets).strip
  print "\n"
  @sudo_password
end