7187946 pkg running in a zone always thinks it's modifying a non-active BE
authorEdward Pilatowicz <edward.pilatowicz@oracle.com>
Thu, 16 Aug 2012 17:51:33 -0700
changeset 2773 9e1e8c67549e
parent 2772 cbeda93b5bbb
child 2774 c35c86a3bc0b
7187946 pkg running in a zone always thinks it's modifying a non-active BE
src/client.py
src/modules/client/api.py
src/modules/client/bootenv.py
--- a/src/client.py	Tue Aug 07 19:40:57 2012 -0700
+++ b/src/client.py	Thu Aug 16 17:51:33 2012 -0700
@@ -953,20 +953,15 @@
         if plan.must_display_notes():
                 disp.append("release-notes")
 
-	# If we're a recursive invocation (indicated by client_output_progfd),
-	# we want to elide messages related to BE management.
-	recursive_child = \
-	    True if global_settings.client_output_progfd is not None else False
-
-	if not api_inst.is_active_liveroot_be and not recursive_child:
-			# Warn the user since this isn't likely what they wanted.
-			if plan.new_be:
-				logger.warning(_("""\
+        if api_inst.is_liveroot and not api_inst.is_active_liveroot_be:
+                # Warn the user since this isn't likely what they wanted.
+                if plan.new_be:
+                        logger.warning(_("""\
 WARNING: The boot environment being modified is not the active one.  Changes
 made in the active BE will not be reflected on the next boot.
 """))
-			else:
-				logger.warning(_("""\
+                else:
+                        logger.warning(_("""\
 WARNING: The boot environment being modified is not the active one.  Changes
 made will not be reflected on the next boot.
 """))
@@ -1016,18 +1011,21 @@
                 else:
                         cond_show(_("Packages to fix:"), "%d", len(a))
 
-		if not recursive_child:
-			status.append((_("Create boot environment:"),
-			    bool_str(plan.new_be)))
-
-			if plan.new_be and (verbose or not plan.activate_be):
-				# Only show activation status if verbose or
-				# if new BE will not be activated.
-				status.append((_("Activate boot environment:"),
-				    bool_str(plan.activate_be)))
-
-			status.append((_("Create backup boot environment:"),
-			    bool_str(plan.backup_be)))
+                # only display BE information if we're operating on the
+                # liveroot environment (since otherwise we'll never be
+                # manipulating BEs).
+                if api_inst.is_liveroot:
+                        status.append((_("Create boot environment:"),
+                            bool_str(plan.new_be)))
+
+                        if plan.new_be and (verbose or not plan.activate_be):
+                                # Only show activation status if verbose or
+                                # if new BE will not be activated.
+                                status.append((_("Activate boot environment:"),
+                                    bool_str(plan.activate_be)))
+
+                        status.append((_("Create backup boot environment:"),
+                            bool_str(plan.backup_be)))
 
                 if not plan.new_be:
                         cond_show(_("Services to change:"), "%d",
--- a/src/modules/client/api.py	Tue Aug 07 19:40:57 2012 -0700
+++ b/src/modules/client/api.py	Thu Aug 16 17:51:33 2012 -0700
@@ -456,7 +456,7 @@
                 """A boolean indicating whether the image to be modified is
                 the active BE for the system's root image."""
 
-                if not self._img.is_liveroot() or self._img.is_zone():
+                if not self._img.is_liveroot():
                         return False
 
                 try:
--- a/src/modules/client/bootenv.py	Tue Aug 07 19:40:57 2012 -0700
+++ b/src/modules/client/bootenv.py	Thu Aug 16 17:51:33 2012 -0700
@@ -351,6 +351,11 @@
                         beList = BootEnv.get_be_list()
 
                         for be in beList:
+                                # don't look at active but unbootable BEs.
+                                # (happens in zones when we have ZBEs
+                                # associated with other global zone BEs.)
+                                if be.get("active_unbootable", False):
+                                        continue
                                 if be.get("active_boot"):
                                         return be.get("orig_be_name")
                 except AttributeError: