Class: DInstaller::DBus::Storage::Proposal

Inherits:
BaseObject
  • Object
show all
Includes:
Interfaces::ServiceStatus, WithServiceStatus
Defined in:
lib/dinstaller/dbus/storage/proposal.rb

Overview

D-Bus object to manage a storage proposal

Constant Summary

Constants included from Interfaces::ServiceStatus

Interfaces::ServiceStatus::SERVICE_STATUS_BUSY, Interfaces::ServiceStatus::SERVICE_STATUS_IDLE, Interfaces::ServiceStatus::SERVICE_STATUS_INTERFACE

Instance Method Summary collapse

Methods included from Interfaces::ServiceStatus

included, #register_service_status_callbacks, #service_status_all, #service_status_current

Methods included from WithServiceStatus

#busy_while, #service_status

Methods inherited from BaseObject

#interfaces_and_properties

Constructor Details

#initialize(backend, logger) ⇒ Proposal

Constructor

Parameters:



43
44
45
46
47
48
49
# File 'lib/dinstaller/dbus/storage/proposal.rb', line 43

def initialize(backend, logger)
  super(PATH, logger: logger)
  @backend = backend

  register_callbacks
  register_service_status_callbacks
end

Instance Method Details

#actionsArray<Hash>

List of sorted actions in D-Bus format

Returns:

  • (Array<Hash>)

See Also:

  • #to_dbus


113
114
115
# File 'lib/dinstaller/dbus/storage/proposal.rb', line 113

def actions
  backend.actions.all.map { |a| action_to_dbus(a) }
end

#available_devicesArray<Array>

List of disks available for installation

Each device is represented by an array containing id and UI label. See the documentation of the available_devices DBus reader.

Returns:

  • (Array<Array>)

See Also:



88
89
90
91
92
# File 'lib/dinstaller/dbus/storage/proposal.rb', line 88

def available_devices
  backend.available_devices.map do |dev|
    [dev.name, backend.device_label(dev), {}]
  end
end

#candidate_devicesObject

See Also:



102
103
104
105
106
# File 'lib/dinstaller/dbus/storage/proposal.rb', line 102

def candidate_devices
  backend.candidate_devices
rescue DInstaller::Storage::Proposal::NoProposalError
  []
end

#lvmObject

See Also:



95
96
97
98
99
# File 'lib/dinstaller/dbus/storage/proposal.rb', line 95

def lvm
  backend.lvm?
rescue DInstaller::Storage::Proposal::NoProposalError
  false
end