Class: DInstaller::Storage::Callbacks::ActivateLuks

Inherits:
Object
  • Object
show all
Includes:
CanAskQuestion
Defined in:
lib/dinstaller/storage/callbacks/activate_luks.rb

Overview

Callbacks for LUKS activation

Instance Method Summary collapse

Methods included from CanAskQuestion

#ask

Constructor Details

#initialize(questions_manager, logger) ⇒ ActivateLuks

Constructor

Parameters:



37
38
39
40
# File 'lib/dinstaller/storage/callbacks/activate_luks.rb', line 37

def initialize(questions_manager, logger)
  @questions_manager = questions_manager
  @logger = logger
end

Instance Method Details

#call(info, attempt) ⇒ Array(Boolean, String)

Note:

The process waits until the question is answered.

Asks whether to activate a LUKS device

Parameters:

  • info (Storage::LuksInfo)
  • attempt (Numeric)

Returns:

  • (Array(Boolean, String))

    The first value is whether to activate the device, and the second one is the LUKS password. Note that the password would only be considered when the first value is true.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/dinstaller/storage/callbacks/activate_luks.rb', line 52

def call(info, attempt)
  question = question(info, attempt)

  ask(question) do |q|
    logger.info("#{q.text} #{q.answer}")

    activate = q.answer == :decrypt
    password = q.password

    [activate, password]
  end
end