Wait for 10 seconds before rebooting

After the image is active wait 10 seconds before rebooting
if "activate and reboot" was selected. We had an issue,
https://github.com/openbmc/openbmc/issues/2764, that a
system could brick if the system reboots before the service
to set the U-Boot variables is complete.
Wait 10 seconds before rebooting to ensure this service is
complete. This issue is fixed in newer images, but the user
may be updating from an older image that does not that have
this fix.

Tested: Verified the system waits 10 seconds after the image
becomes active before rebooting.

Change-Id: I00115680cca14e50814e44c302d6134aca242d3f
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/configuration/controllers/firmware-controller.js b/app/configuration/controllers/firmware-controller.js
index 618cad8..50cff28 100644
--- a/app/configuration/controllers/firmware-controller.js
+++ b/app/configuration/controllers/firmware-controller.js
@@ -22,7 +22,8 @@
                 'Constants',
                 '$interval',
                 '$q',
-                function ($scope, $window, APIUtils, dataService, $location, $anchorScroll, Constants, $interval, $q) {
+                '$timeout',
+                function ($scope, $window, APIUtils, dataService, $location, $anchorScroll, Constants, $interval, $q, $timeout) {
                     $scope.dataService = dataService;
 
                     //Scroll to target anchor
@@ -123,14 +124,23 @@
                           });
                         }).then(function(state){
                           if($scope.activate.reboot){
-                            APIUtils.bmcReboot(function(response){}, function(error){
-                              $scope.displayError({
-                                modal_title: 'Error during BMC reboot',
-                                title: 'Error during BMC reboot',
-                                desc: JSON.stringify(error.data),
-                                type: 'Error'
+                            // Despite the new image being active, issue,
+                            // https://github.com/openbmc/openbmc/issues/2764, can cause a
+                            // system to brick, if the system reboots before the service to set
+                            // the U-Boot variables is complete. Wait 10 seconds before rebooting
+                            // to ensure this service is complete. This issue is fixed in newer images, but
+                            // the user may be updating from an older image that does not that have this fix.
+                            // TODO: remove this timeout after sufficient time has passed.
+                            $timeout(function() {
+                              APIUtils.bmcReboot(function(response){}, function(error){
+                                $scope.displayError({
+                                  modal_title: 'Error during BMC reboot',
+                                  title: 'Error during BMC reboot',
+                                  desc: JSON.stringify(error.data),
+                                  type: 'Error'
+                                });
                               });
-                            });
+                            }, 10000);
                           }
                         });
                       });