--- a/usr/src/cmd/distro_const/checkpoints/pkg_img_mod.py Fri Jun 01 23:40:07 2012 +0100
+++ b/usr/src/cmd/distro_const/checkpoints/pkg_img_mod.py Mon Jun 04 19:19:12 2012 +0200
@@ -21,7 +21,7 @@
#
#
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
""" pkg_img_mod
@@ -214,6 +214,7 @@
shutil.move("opt", "miscdirs")
shutil.move("etc", "miscdirs")
shutil.move("var", "miscdirs")
+ shutil.move("save", "miscdirs")
# add Software node to install items from /mnt/misc
@@ -323,21 +324,6 @@
os.chdir(cwd)
- def populate_save_list(self):
- '''Store a list of files under the 'save' directory. Net-booted
- text installer uses this list to determine what files it needs from
- the boot server
- '''
- save_files = []
- save_dir = os.path.join(self.pkg_img_path, "save")
- for root, _none, files in os.walk(save_dir):
- for f in files:
- relpath = os.path.relpath(os.path.join(root, f),
- start=self.pkg_img_path)
- save_files.append(relpath)
-
- self.add_content_list_to_doc(save_files)
-
def execute(self, dry_run=False):
"""Customize the pkg_image area. Assumes that a populated pkg_image
area exists and that the boot_archive has been built
@@ -503,8 +489,13 @@
else:
self.strip_sparc_platform()
- # populate the value from the save directory into the DOC
- self.populate_save_list()
+ # Generate transfer manifest with empty contents
+ # for "transfer-media" transaction, since text installer booted
+ # from network has nothing to transfer from media
+ # to install target.
+ # We can't completely omit that transaction in transfer manifest,
+ # as transfer mechanism insists on having that defined.
+ self.add_content_list_to_doc([])
finally:
# return to the initial directory
--- a/usr/src/cmd/distro_const/checkpoints/test/test_pkg_img_mod.py Fri Jun 01 23:40:07 2012 +0100
+++ b/usr/src/cmd/distro_const/checkpoints/test/test_pkg_img_mod.py Mon Jun 04 19:19:12 2012 +0200
@@ -21,7 +21,7 @@
#
#
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
""" test_pkg_img_mod
@@ -123,6 +123,7 @@
"/etc/",
"/etc/sbin/lofiadm",
"/etc/file1/file2",
+ "/save/etc/shadow",
"/var/",
"/var/file2/file3/file4",
"/var/file3/file3/file4/file5",
--- a/usr/src/lib/install_transfer/cpio.py Fri Jun 01 23:40:07 2012 +0100
+++ b/usr/src/lib/install_transfer/cpio.py Mon Jun 04 19:19:12 2012 +0200
@@ -413,6 +413,11 @@
'''
if trans.action == "install":
fl_data = self.validate_contents(trans.contents)
+
+ # if there is nothing to transfer, just return
+ if fl_data is None:
+ return None
+
if isinstance(fl_data, list):
# Go through the list and find directory entries
bflist = list(fl_data)
@@ -488,11 +493,14 @@
self.pmon.startmonitor(self.dst, self.distro_size)
for trans in self._transfer_list:
- # before starting any transforms, installs or uninstalls, first
- # verify this transaction has contents to operate on
+ # Before starting any transforms, installs or uninstalls, first
+ # verify this transaction has contents to operate on. Tolerate
+ # if there is no contents to be manipulated, and skip the action
+ # in such case.
if trans.get(CONTENTS) is None:
- raise RuntimeError("%s action has no contents" % \
+ self.logger.debug("Skipping %s action, it has no contents" % \
trans.get(ACTION))
+ continue
if trans.get(ACTION) == "transform":
if not self.dry_run:
self.run_exec_file(trans.get(CONTENTS))
--- a/usr/src/lib/install_transfer/media_transfer.py Fri Jun 01 23:40:07 2012 +0100
+++ b/usr/src/lib/install_transfer/media_transfer.py Mon Jun 04 19:19:12 2012 +0200
@@ -471,25 +471,4 @@
setup_doc_content(manifest_name, NetPrepareMediaTransfer.MEDIA_SOURCE)
- # Take a look at "transfer-media" node of the DOC, and download
- # all listed files
-
- doc = InstallEngine.get_instance().data_object_cache
-
- software_nodes = doc.volatile.get_descendants(class_type=Software)
-
- for software in software_nodes:
- if software._name == TRANSFER_MEDIA:
- cpio_spec = software.get_children(class_type=CPIOSpec,
- not_found_is_err=True)
- file_list = (cpio_spec[0]).contents
- for file in file_list:
- # download each file
- dst_name = \
- os.path.join(NetPrepareMediaTransfer.MEDIA_SOURCE, \
- file)
- self.logger.debug("Downloading " + file)
- download_files(server_url + "/" + file, dst_name,
- self.logger)
-
unmount_libc_overlay(self.logger)
--- a/usr/src/lib/install_transfer/test/test_cpio.py Fri Jun 01 23:40:07 2012 +0100
+++ b/usr/src/lib/install_transfer/test/test_cpio.py Mon Jun 04 19:19:12 2012 +0200
@@ -315,7 +315,7 @@
self.fail(str(err))
def test_cpio_w_empty_list(self):
- ''' Test that an error is raised when contents list is empty'''
+ ''' Test that "empty contents list" scenario is handled'''
# Set up the source
src = Source()
path = Dir(self.TEST_SRC_DIR)
@@ -333,10 +333,13 @@
self.tr_node.action = "install"
self.tr_node.contents = []
- self.assertRaises(Exception, self.tr_cpio.execute, dry_run=True)
+ try:
+ self.tr_cpio.execute(dry_run=True)
+ except Exception as err:
+ self.fail(str(err))
def test_cpio_no_contents(self):
- ''' Test that an error is raised when no contents exist'''
+ ''' Test that "no contents" scenario is handled'''
# Set up the source
src = Source()
path = Dir(self.TEST_SRC_DIR)
@@ -353,7 +356,10 @@
# The CPIO values that are specified - no contents
self.tr_node.action = "install"
- self.assertRaises(Exception, self.tr_cpio.execute, dry_run=True)
+ try:
+ self.tr_cpio.execute(dry_run=True)
+ except Exception as err:
+ self.fail(str(err))
def test_skip_file_list_file(self):
'''Test the success of using skip_file_list'''
@@ -709,8 +715,8 @@
progress_estimate = self.tr_cpio.get_progress_estimate()
expect_estimate = \
- int((float(size_to_transfer/1024) / self.tr_cpio.DEFAULT_SIZE) * \
- self.tr_cpio.DEFAULT_PROG_EST)
+ int((float(size_to_transfer / 1024) / self.tr_cpio.DEFAULT_SIZE) \
+ * self.tr_cpio.DEFAULT_PROG_EST)
self.assertEqual(progress_estimate, expect_estimate)