Skip to content

Commit

Permalink
Merge pull request #28 from yast/added_abort_warning
Browse files Browse the repository at this point in the history
Display a hint to rollback the system from snapshot/backup when migration fails
  • Loading branch information
lslezak committed Oct 6, 2015
2 parents 5d9a35a + 0646069 commit f40fda3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
7 changes: 7 additions & 0 deletions package/yast2-migration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
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)
- 3.1.12

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

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-migration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-migration
Version: 3.1.11
Version: 3.1.12
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
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 system is in partly migrated state and 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 f40fda3

Please sign in to comment.