9363 pm-updatemanager thoroughly broken when used with -R option
authorMichal Pryc <Michal.Pryc@Sun.Com>
Wed, 22 Jul 2009 19:01:40 -0700
changeset 1259 ee4f1901712e
parent 1258 2c27280fc3cb
child 1260 f41c7080c71f
9363 pm-updatemanager thoroughly broken when used with -R option
src/gui/modules/installupdate.py
src/packagemanager.py
src/tests/gui_pylintrc
src/updatemanager.py
--- a/src/gui/modules/installupdate.py	Fri Jul 24 08:18:16 2009 +0100
+++ b/src/gui/modules/installupdate.py	Wed Jul 22 19:01:40 2009 -0700
@@ -59,7 +59,8 @@
         def __init__(self, list_of_packages, parent, api_o,
             ips_update = False, action = -1, be_name = None, 
             parent_name = "", pkg_list = None, main_window = None,
-            icon_confirm_dialog = None, title = None, web_install = False):
+            icon_confirm_dialog = None, title = None, web_install = False,
+            skip_be_dialog = False):
                 if action == -1:
                         return
                 progress.GuiProgressTracker.__init__(self)
@@ -212,7 +213,7 @@
                 elif self.action == enumerations.IMAGE_UPDATE:
                         self.w_dialog.set_title(_("Update All"))
                         w_ua_proceed_button.grab_focus()
-                        if not self.be_name:
+                        if not self.be_name and not skip_be_dialog:
                                 if nobe or not "beVerifyBEName" in be.__dict__:
                                         self.w_ua_be_name_box.set_property(
                                             "visible", False)
@@ -504,7 +505,6 @@
                         return
                 except (api_errors.UnableToCopyBE, 
                     api_errors.UnableToMountBE,
-                    api_errors.BENameGivenOnDeadBE,
                     api_errors.UnableToRenameBE,
                     api_errors.PermissionsException,
                     api_errors.PlanCreationException,
@@ -512,6 +512,17 @@
                         msg = str(ex)
                         self.__g_error_stage(msg)
                         return
+                except api_errors.BENameGivenOnDeadBE, ex:
+                        # 9363. We will try again to perform image-update
+                        # but this time without passing be_name to the api
+                        # if this fails for the second time, we will print error.
+                        if self.proposed_be_name != None:
+                                self.proposed_be_name = None
+                                self.__proceed_with_stages_thread_ex()
+                        else:
+                                msg = str(ex)
+                                self.__g_error_stage(msg)
+                                return
                 # We do want to prompt user to load BE admin if there is
                 # not enough disk space. This error can either come as an
                 # error within API exception, see bug #7642 or as a standalone
--- a/src/packagemanager.py	Fri Jul 24 08:18:16 2009 +0100
+++ b/src/packagemanager.py	Wed Jul 22 19:01:40 2009 -0700
@@ -215,6 +215,7 @@
                 self.progress_stop_thread = True
                 self.catalog_loaded = False
                 self.image_dir_arg = None
+                self.user_image_dir = False
                 self.update_all_proceed = False
                 self.ua_be_name = None
                 self.application_path = None
@@ -2534,7 +2535,8 @@
                     action = enumerations.IMAGE_UPDATE, be_name = self.ua_be_name,
                     parent_name = _("Package Manager"),
                     pkg_list = ["SUNWipkg", "SUNWipkg-gui"],
-                    main_window = self.w_main_window)
+                    main_window = self.w_main_window,
+                    skip_be_dialog = self.user_image_dir)
                 return
 
         def __on_ua_completed_linkbutton_clicked(self, widget):
@@ -4025,6 +4027,7 @@
         ua_be_name = None
         app_path = None
         image_dir = None
+        user_image_dir = False
         info_install_arg = None
         save_selected = _("Save selected...")
         save_selected_pkgs = _("Save selected packages...")
@@ -4052,6 +4055,7 @@
                         sys.exit(0)
                 if option in ("-R", "--image-dir"):
                         image_dir = argument
+                        user_image_dir = True
                 if option in ("-U", "--update-all"):
                         update_all_proceed = True
                         ua_be_name = argument
@@ -4061,6 +4065,7 @@
         if image_dir == None:
                 try:
                         image_dir = os.environ["PKG_IMAGE"]
+                        user_image_dir = True
                 except KeyError:
                         image_dir = os.getcwd()
         try:
@@ -4083,6 +4088,7 @@
         packagemanager = PackageManager()
         packagemanager.application_path = app_path
         packagemanager.image_dir_arg = image_dir
+        packagemanager.user_image_dir = user_image_dir
         packagemanager.update_all_proceed = update_all_proceed
         packagemanager.ua_be_name = ua_be_name
 
--- a/src/tests/gui_pylintrc	Fri Jul 24 08:18:16 2009 +0100
+++ b/src/tests/gui_pylintrc	Wed Jul 22 19:01:40 2009 -0700
@@ -129,7 +129,7 @@
 max-returns=22
 
 # Maximum number of branch for function / method body
-max-branchs=34
+max-branchs=38
 
 # Maximum number of statements in function / method body
 max-statements=260
--- a/src/updatemanager.py	Fri Jul 24 08:18:16 2009 +0100
+++ b/src/updatemanager.py	Wed Jul 22 19:01:40 2009 -0700
@@ -617,6 +617,9 @@
                 self.__selectall_toggle(True)
                 self.__get_api_obj().reset()
                 self.ua_start = time.time()
+                skip_be_dlg = False
+                if self.__get_image_path() != IMAGE_DIRECTORY_DEFAULT:
+                        skip_be_dlg = True
                 installupdate.InstallUpdate([], self,
                     self.api_obj, ips_update = False,
                     action = enumerations.IMAGE_UPDATE,
@@ -624,7 +627,8 @@
                     parent_name = _("Update Manager"),
                     pkg_list = ["SUNWipkg", "SUNWipkg-gui", "SUNWipkg-um"],
                     main_window = self.w_um_dialog,
-                    icon_confirm_dialog = self.__get_icon_pixbuf("UM_package", 36))
+                    icon_confirm_dialog = self.__get_icon_pixbuf("UM_package", 36),
+                    skip_be_dialog = skip_be_dlg)
                 return
                
         def __on_selectall_checkbutton_toggled(self, widget):