[gnome-boxes] Unattended install preparation errors should be non fatal



commit 07c0020348f2939cf8bad59a6c5d482eeee8738d
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Thu Aug 30 15:18:39 2012 +0200

    Unattended install preparation errors should be non fatal
    
    When an error occurs during unattended installation preparation,
    it's still highly likely that we can go on with non-express
    installation. This commit catches errors in prepare_for_installation
    and falls back to trying a non-express install when an error occurs
    during preparation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682934

 src/unattended-installer.vala |    4 ++++
 src/vm-creator.vala           |    7 ++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 4e6583d..a1ea8b3 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -146,6 +146,10 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
                 yield unattended_file.copy (cancellable);
         } catch (GLib.Error error) {
             clean_up ();
+            // An error occurred when trying to setup unattended installation, but it's likely that a non-unattended installation
+            // will work. When this happens, just disable unattended installs, and let the caller decide if it wants to retry a
+            // non-automatic install or to just abort the box creation..
+            express_toggle.active = false;
 
             throw error;
         } finally {
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 378098f..1b6c52e 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -39,7 +39,12 @@ private class Boxes.VMCreator {
 
         string title, name;
         yield create_domain_name_and_title_from_media (out name, out title);
-        yield install_media.prepare_for_installation (name, cancellable);
+        try {
+            yield install_media.prepare_for_installation (name, cancellable);
+        } catch (GLib.Error error) {
+            App.app.notificationbar.display_error (_("An error occurred during installation preparation. Express Install disabled."));
+            debug("Disabling unattended installation: %s", error.message);
+        }
 
         var volume = yield create_target_volume (name, install_media.resources.storage);
         var caps = yield connection.get_capabilities_async (cancellable);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]