Module: DInstallerCli::Commands::EnsureConfigPhase

Included in:
Main, Storage
Defined in:
lib/dinstaller_cli/commands/ensure_config_phase.rb

Overview

Note:

Requires a #manager_client method that returns an instance of DInstaller::DBus::Clients::Manager.

Mixin that provides methods to ensure a specific installation phase while running code

Instance Method Summary collapse

Instance Method Details

#config_phase?Boolean

Whether the manager client is in config phase

Returns:

  • (Boolean)


42
43
44
# File 'lib/dinstaller_cli/commands/ensure_config_phase.rb', line 42

def config_phase?
  manager_client.current_installation_phase == DInstaller::InstallationPhase::CONFIG
end

#ensure_config_phase(&block) ⇒ Object

Ensures the config phase is executed before calling the given block

Parameters:

  • block (Proc)


34
35
36
37
# File 'lib/dinstaller_cli/commands/ensure_config_phase.rb', line 34

def ensure_config_phase(&block)
  manager_client.probe unless config_phase?
  block.call
end