7042314 solaris_install.target.be.be_list() should get information about which is the active BE
authorDrew Fisher <drew.fisher@oracle.com>
Thu, 05 May 2011 13:47:10 -0600
changeset 1110 17d2e44bfc3f
parent 1109 ad13b6eeaad4
child 1111 0c6c862af34f
7042314 solaris_install.target.be.be_list() should get information about which is the active BE 7042322 CPIOTransfer checkpoint is not removing symlinks
usr/src/lib/install_target/discovery.py
usr/src/lib/install_target/libbe/be.py
usr/src/lib/install_transfer/cpio.py
--- a/usr/src/lib/install_target/discovery.py	Thu May 05 11:43:50 2011 -0700
+++ b/usr/src/lib/install_target/discovery.py	Thu May 05 13:47:10 2011 -0600
@@ -510,7 +510,7 @@
             if zpool_name and zpool_name != zpool.name:
                 continue
 
-            for be_name, be_pool, root_ds in be_list:
+            for be_name, be_pool, root_ds, is_active in be_list:
                 if be_pool == zpool.name:
                     zpool.insert_children(BE(be_name))
 
--- a/usr/src/lib/install_target/libbe/be.py	Thu May 05 11:43:50 2011 -0700
+++ b/usr/src/lib/install_target/libbe/be.py	Thu May 05 13:47:10 2011 -0600
@@ -39,7 +39,6 @@
     """
     # create a new pointer to a pointer
     be_node_list = C.pointer(C.pointer(cstruct.BENodeList()))
-    # pylint: disable-msg=E1101
     err = cfunc.be_list(name, be_node_list)
     if err == const.BE_ERR_BE_NOENT:
         # there are no BEs, so just return an empty list.
@@ -50,13 +49,24 @@
     # dereference both pointers
     node = be_node_list.contents.contents
 
-    name_list = [(node.be_node_name, node.be_rpool, node.be_root_ds)]
+    name_list = [
+        (node.be_node_name,
+         node.be_rpool,
+         node.be_root_ds,
+         node.be_active == True
+        )
+    ]
     while node.be_next_node:
         node = node.be_next_node.contents
-        name_list.append((node.be_node_name, node.be_rpool, node.be_root_ds))
+        name_list.append(
+            (node.be_node_name,
+             node.be_rpool,
+             node.be_root_ds,
+             node.be_active == True
+            )
+        )
 
     # free the memory used by be_list
-    # pylint: disable-msg=E1101
     cfunc.be_free_list(be_node_list.contents)
 
     return name_list
--- a/usr/src/lib/install_transfer/cpio.py	Thu May 05 11:43:50 2011 -0700
+++ b/usr/src/lib/install_transfer/cpio.py	Thu May 05 13:47:10 2011 -0600
@@ -36,7 +36,6 @@
 import tempfile
 
 from osol_install.install_utils import file_size
-from solaris_install.data_object import ObjectNotFoundError
 from solaris_install.engine.checkpoint import AbstractCheckpoint as Checkpoint
 from solaris_install.engine import InstallEngine
 from solaris_install.transfer.info import Args
@@ -45,8 +44,7 @@
 from solaris_install.transfer.info import Dir
 from solaris_install.transfer.info import Software
 from solaris_install.transfer.info import Source
-from solaris_install.transfer.info import ACTION, CONTENTS, \
-TYPE, CPIO_ARGS
+from solaris_install.transfer.info import ACTION, CONTENTS, CPIO_ARGS
 from solaris_install.transfer.prog import ProgressMon
 
 
@@ -507,26 +505,20 @@
                                        trans.get(CPIO_ARGS))
 
             elif trans.get(ACTION) == "uninstall":
-                    self.logger.debug("Removing specified files "
-                                      "and directories")
-                    if not self.dry_run:
-                        for item in trans.get(CONTENTS):
+                self.logger.debug("Removing specified files "
+                                  "and directories")
+                if not self.dry_run:
+                    for item in trans.get(CONTENTS):
+                        entry = os.path.join(self.dst, item.rstrip())
+                        try:
                             if os.path.isdir(item):
-                                try:
-                                    shutil.rmtree(os.path.join(self.dst,
-                                                               item.rstrip()))
-                                except OSError:
-                                    # If the dir isn't there that's what we
-                                    # wanted anyway so just continue.
-                                    pass
-                            elif os.path.isfile(item):
-                                try:
-                                    os.unlink(os.path.join(self.dst,
-                                                           item.rstrip()))
-                                except OSError:
-                                # If the file isn't there that's what we
-                                # wanted anyway so just continue.
-                                    pass
+                                shutil.rmtree(entry)
+                            else:
+                                os.unlink(entry)
+                        except OSError:
+                            # If the item isn't there that's what we
+                            # wanted anyway so just continue.
+                            pass
 
         if self.pmon:
             self.pmon.done = True