Skip to content

Commit

Permalink
display a hint when package installation is aborted (FATE#315161)
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Oct 6, 2015
1 parent 5d9a35a commit 2ca5d5d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package/yast2-migration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 6 06:58:08 UTC 2015 - lslezak@suse.cz

- display a hint to manually rollback the system when migration
fails or is aborted during package installation (FATE#315161)

-------------------------------------------------------------------
Thu Sep 24 19:12:38 UTC 2015 - lslezak@suse.cz

Expand Down
2 changes: 1 addition & 1 deletion src/clients/migration_proposals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
Yast::Wizard.CloseDialog
end

ret
return ret
16 changes: 16 additions & 0 deletions src/lib/migration/main_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,25 @@ def perform_migration
# this client is located in the yast2-packager package
ret = Yast::WFM.CallFunction("inst_rpmcopy")
log.info "inst_rpmcopy result: #{ret.inspect}"

display_abort_message if ret == :abort || ret == :cancel

ret
end

def display_abort_message
Yast::Report.Error(
# TRANSLATORS: an error message, the migration to a new service pack failed
# or was aborted, the partly migrated system should be restored from
# a snapshot or backup
_("The migration to the new service pack has failed. The system is most\n" \
"likely in an inconsistent state.\n" \
"\n" \
"We strongly recommend to rollback to a snapshot created before the\n" \
"migration was started (via selecting the snapshot in the boot menu\n" \
"if you use snapper) or restore the system from a backup."))
end

def create_pre_snapshot
if snapper_configured?
self.pre_snapshot = perform_snapshot(:pre, "before online migration")
Expand Down
1 change: 1 addition & 0 deletions test/main_workflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def mock_client(name, res)

it "aborts without rollback when the package installation is aborted" do
mock_client("inst_rpmcopy", :abort)
expect(Yast::Report).to receive(:Error).with(/migration to the new service pack has failed/)
expect(Yast::WFM).to_not receive(:CallFunction).with("registration_sync")

expect(::Migration::MainWorkflow.run).to eq :abort
Expand Down

0 comments on commit 2ca5d5d

Please sign in to comment.