Skip to content

Commit

Permalink
storage: recover config if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Dec 20, 2024
1 parent 654eabc commit df210c3
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions service/lib/agama/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,19 @@ def startup_phase
service_status.idle
end

def locale=(locale)
service_status.busy
change_process_locale(locale)
users.update_issues
start_progress_with_descriptions(
_("Load software translations"),
_("Load storage translations")
)
progress.step { software.locale = locale }
progress.step { storage.locale = locale }
ensure
service_status.idle
finish_progress
end

# Runs the config phase
def config_phase
service_status.busy
first_time = installation_phase.startup?
installation_phase.config

start_progress_with_descriptions(
_("Analyze disks"), _("Configure software")
)
progress.step { storage.probe }
# FIXME: hot-fix for bsc#1234711, see {#probe_and_recover_storage}. In autoinstallation, the
# storage config could be applied before probing. In that case, the config has to be
# recovered.
progress.step { first_time ? probe_and_recover_storage : storage.probe }
progress.step { software.probe }

logger.info("Config phase done")
Expand Down Expand Up @@ -159,6 +148,21 @@ def install_phase
end
# rubocop:enable Metrics/AbcSize

def locale=(locale)
service_status.busy
change_process_locale(locale)
users.update_issues
start_progress_with_descriptions(
_("Load software translations"),
_("Load storage translations")
)
progress.step { software.locale = locale }
progress.step { storage.locale = locale }
ensure
service_status.idle
finish_progress
end

# Software client
#
# @return [DBus::Clients::Software]
Expand Down Expand Up @@ -273,5 +277,12 @@ def iguana?

# @return [ServiceStatusRecorder]
attr_reader :service_status_recorder

# Probes storage and recover the current config, if any.
def probe_and_recover_storage
storage_config = storage.config
storage.probe
storage.config = storage_config unless storage_config.empty?
end
end
end

0 comments on commit df210c3

Please sign in to comment.