Class: DInstaller::Manager
- Inherits:
-
Object
- Object
- DInstaller::Manager
- Includes:
- WithProgress
- Defined in:
- lib/dinstaller/manager.rb
Overview
This class represents the top level installer manager.
It is responsible for orchestrating the installation process. For module specific stuff it delegates it to the corresponding module class (e.g., Network, Storage::Proposal, etc.) or asks other services via D-Bus (e.g., ‘org.opensuse.DInstaller.Software`).
Instance Attribute Summary collapse
- #installation_phase ⇒ InstallationPhase readonly
- #logger ⇒ Logger readonly
- #questions_manager ⇒ QuestionsManager readonly
Attributes included from WithProgress
Instance Method Summary collapse
-
#busy_services ⇒ Array<String>
Name of busy services.
-
#config_phase ⇒ Object
Runs the config phase.
-
#initialize(config, logger) ⇒ Manager
constructor
Constructor.
-
#install_phase ⇒ Object
Runs the install phase rubocop:disable Metrics/AbcSize.
-
#language ⇒ DBus::Clients::Language
Language manager.
-
#network ⇒ Network
Network manager.
-
#on_services_status_change(&block) ⇒ Object
Registers a callback to be called when the status of a service changes.
-
#security ⇒ Security
Security manager.
-
#select_product(product) ⇒ Object
Actions to perform when a product is selected.
-
#software ⇒ DBus::Clients::Software
Software client.
-
#startup_phase ⇒ Object
Runs the startup phase.
-
#storage ⇒ Storage::Manager
Storage manager.
-
#users ⇒ DBus::Clients::Users
Users client.
Methods included from WithProgress
#on_progress_change, #on_progress_finish, #start_progress
Constructor Details
#initialize(config, logger) ⇒ Manager
Constructor
61 62 63 64 65 66 67 |
# File 'lib/dinstaller/manager.rb', line 61 def initialize(config, logger) @config = config @logger = logger @questions_manager = QuestionsManager.new(logger) @installation_phase = InstallationPhase.new @service_status_recorder = ServiceStatusRecorder.new end |
Instance Attribute Details
#installation_phase ⇒ InstallationPhase (readonly)
56 57 58 |
# File 'lib/dinstaller/manager.rb', line 56 def installation_phase @installation_phase end |
#logger ⇒ Logger (readonly)
50 51 52 |
# File 'lib/dinstaller/manager.rb', line 50 def logger @logger end |
#questions_manager ⇒ QuestionsManager (readonly)
53 54 55 |
# File 'lib/dinstaller/manager.rb', line 53 def questions_manager @questions_manager end |
Instance Method Details
#busy_services ⇒ Array<String>
Name of busy services
206 207 208 |
# File 'lib/dinstaller/manager.rb', line 206 def busy_services service_status_recorder.busy_services end |
#config_phase ⇒ Object
Runs the config phase
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/dinstaller/manager.rb', line 79 def config_phase installation_phase.config storage.probe(questions_manager) security.probe network.probe logger.info("Config phase done") rescue StandardError => e logger.error "Startup error: #{e.inspect}. Backtrace: #{e.backtrace}" # TODO: report errors end |
#install_phase ⇒ Object
Runs the install phase rubocop:disable Metrics/AbcSize
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/dinstaller/manager.rb', line 94 def install_phase installation_phase.install start_progress(9) progress.step("Reading software repositories") do software.probe Yast::Installation.destdir = "/mnt" end progress.step("Partitioning") do # lets propose it here to be sure that software proposal reflects product selection # FIXME: maybe repropose after product selection change? # first make bootloader proposal to be sure that required packages are installed proposal = ::Bootloader::ProposalClient.new.make_proposal({}) logger.info "Bootloader proposal #{proposal.inspect}" storage.install # propose software after /mnt is already separated, so it uses proper # target software.propose # call inst bootloader to get properly initialized bootloader # sysconfig before package installation Yast::WFM.CallFunction("inst_bootloader", []) end progress.step("Installing Software") { software.install } on_target do progress.step("Writing Users") { users.write } progress.step("Writing Network Configuration") { network.install } progress.step("Installing Bootloader") do security.write ::Bootloader::FinishClient.new.write end progress.step("Saving Language Settings") { language.finish } progress.step("Writing repositories information") { software.finish } progress.step("Finishing installation") { finish_installation } end logger.info("Install phase done") end |
#language ⇒ DBus::Clients::Language
Language manager
157 158 159 |
# File 'lib/dinstaller/manager.rb', line 157 def language @language ||= DBus::Clients::Language.new end |
#network ⇒ Network
Network manager
175 176 177 |
# File 'lib/dinstaller/manager.rb', line 175 def network @network ||= Network.new(logger) end |
#on_services_status_change(&block) ⇒ Object
Registers a callback to be called when the status of a service changes
213 214 215 |
# File 'lib/dinstaller/manager.rb', line 213 def on_services_status_change(&block) service_status_recorder.on_service_status_change(&block) end |
#security ⇒ Security
Security manager
189 190 191 |
# File 'lib/dinstaller/manager.rb', line 189 def security @security ||= Security.new(logger, config) end |
#select_product(product) ⇒ Object
The config phase is executed.
Actions to perform when a product is selected
196 197 198 199 |
# File 'lib/dinstaller/manager.rb', line 196 def select_product(product) config.pick_product(product) config_phase end |
#software ⇒ DBus::Clients::Software
Software client
146 147 148 149 150 151 152 |
# File 'lib/dinstaller/manager.rb', line 146 def software @software ||= DBus::Clients::Software.new.tap do |client| client.on_service_status_change do |status| service_status_recorder.save(client.service.name, status) end end end |
#startup_phase ⇒ Object
Runs the startup phase
70 71 72 73 74 75 76 |
# File 'lib/dinstaller/manager.rb', line 70 def startup_phase installation_phase.startup probe_single_product unless config.multi_product? logger.info("Startup phase done") end |
#storage ⇒ Storage::Manager
Storage manager
182 183 184 |
# File 'lib/dinstaller/manager.rb', line 182 def storage @storage ||= Storage::Manager.new(logger, config) end |
#users ⇒ DBus::Clients::Users
Users client
164 165 166 167 168 169 170 |
# File 'lib/dinstaller/manager.rb', line 164 def users @users ||= DBus::Clients::Users.new.tap do |client| client.on_service_status_change do |status| service_status_recorder.save(client.service.name, status) end end end |