Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restore (enable) the Updates repositories (bsc#943960)
...at the end of the migration workflow Conflicts: src/lib/registration/ui/media_addon_workflow.rb test/media_addon_workflow_spec.rb test/registration_ui_test.rb test/sw_mgmt_spec.rb
- Loading branch information
Showing
14 changed files
with
504 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2015 SUSE LLC | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of version 2 of the GNU General Public License as published by the | ||
# Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
# | ||
|
||
require "yast" | ||
require "registration/ui/migration_finish_workflow" | ||
|
||
module Yast | ||
class MigrationFinishClient < Client | ||
Yast.import "Wizard" | ||
|
||
def main | ||
textdomain "registration" | ||
|
||
# create the Wizard dialog if needed | ||
wizard_present = Wizard.IsWizardDialog | ||
Wizard.CreateDialog unless wizard_present | ||
|
||
begin | ||
::Registration::UI::MigrationFinishWorkflow.run | ||
ensure | ||
Wizard.CloseDialog unless wizard_present | ||
end | ||
end | ||
end unless defined?(YaST::MigrationFinishClient) | ||
end | ||
|
||
Yast::MigrationFinishClient.new.main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2015 SUSE LLC | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of version 2 of the GNU General Public License as published by the | ||
# Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
# | ||
|
||
require "yast" | ||
|
||
require "registration/repo_state" | ||
|
||
module Registration | ||
module UI | ||
# This class handles the workflow for finishing the online migration | ||
class MigrationFinishWorkflow | ||
include Yast::Logger | ||
include Yast::I18n | ||
include Yast::UIShortcuts | ||
|
||
Yast.import "Report" | ||
Yast.import "Sequencer" | ||
|
||
# run workflow for adding the migration services | ||
# @return [Symbol] the UI symbol | ||
def self.run | ||
workflow = MigrationFinishWorkflow.new | ||
workflow.run | ||
end | ||
|
||
# the constructor | ||
def initialize | ||
textdomain "registration" | ||
end | ||
|
||
# The migration finish workflow is: | ||
# - restore the saved repository states (i.e. enable the Updates | ||
# repositories when they were disabled during migration) | ||
def run | ||
ret = nil | ||
begin | ||
ret = run_sequence | ||
rescue => e | ||
log.error "Caught error: #{e.class}: #{e.message.inspect}, #{e.backtrace}" | ||
# TRANSLATORS: error message, %s are details | ||
Yast::Report.Error(_("Internal error: %s") % e.message) | ||
ret = :abort | ||
end | ||
|
||
ret | ||
end | ||
|
||
private | ||
|
||
WORKFLOW_SEQUENCE = { | ||
"ws_start" => "restore_repos", | ||
"restore_repos" => { | ||
abort: :abort, | ||
next: :next | ||
} | ||
} | ||
|
||
# run the workflow | ||
# @return [Symbol] the UI symbol | ||
def run_sequence | ||
aliases = { | ||
"restore_repos" => ->() { restore_repos } | ||
} | ||
|
||
ui = Yast::Sequencer.Run(aliases, WORKFLOW_SEQUENCE) | ||
log.info "User input: #{ui}" | ||
ui | ||
end | ||
|
||
# restore all saved repository states | ||
def restore_repos | ||
log.info "Restoring the original repository setup..." | ||
repo_state = RepoStateStorage.instance | ||
repo_state.read | ||
repo_state.restore_all | ||
:next | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.