7001589 Implement a Transfer.create_checkpoint method - fix merge errors
7034744 Transfer module should comply with the updated interfaces for DOC
--- a/usr/src/lib/install_transfer/cpio.py Wed Apr 06 23:20:22 2011 -0600
+++ b/usr/src/lib/install_transfer/cpio.py Thu Apr 07 13:51:29 2011 -0600
@@ -502,7 +502,8 @@
trans.get(CPIO_ARGS))
elif trans.get(ACTION) == "uninstall":
- self.logger.debug("Removing specified files and directories")
+ self.logger.debug("Removing specified files "
+ "and directories")
if not self.dry_run:
for item in trans.get(CONTENTS):
if os.path.isdir(item):
@@ -582,17 +583,14 @@
for trans in transfer_list:
trans_attr = dict()
- # Get the Args from the DOC if they exist. If not specified,
- # use the default value.
- try:
- args = trans.get_children(Args.ARGS_LABEL, Args)
- except ObjectNotFoundError:
- args = None
+ args = trans.get_children(name=Args.ARGS_LABEL, class_type=Args)
# An argument was specified, validate that the user
# only specified one and that it was cpio_args. Anything
# else is illegal.
- if args is not None:
+ # if no args are specified use the default list.
+
+ if args:
if len(args) > 1:
self._cleanup_tmp_files()
raise ValueError("Invalid to specify cpio "
--- a/usr/src/lib/install_transfer/info.py Wed Apr 06 23:20:22 2011 -0600
+++ b/usr/src/lib/install_transfer/info.py Thu Apr 07 13:51:29 2011 -0600
@@ -73,7 +73,6 @@
super(Software, self).__init__(Software.SOFTWARE_LABEL)
self._name = name
self.tran_type = type
- self.trans_type = None
def to_xml(self):
'''Method to create the xml software element with
@@ -82,8 +81,8 @@
element = etree.Element(Software.SOFTWARE_LABEL)
if self._name is not None:
element.set(Software.SOFTWARE_NAME_LABEL, self._name)
- if self._type is not None:
- element.set(Software.SOFTWARE_TYPE_LABEL, self._type)
+ if self.tran_type is not None:
+ element.set(Software.SOFTWARE_TYPE_LABEL, self.tran_type)
return element
@classmethod
@@ -119,7 +118,7 @@
# The software_data element holds the items that will be
# transferred. The val variable identifies what type of transfer
# object to create. The action is either to install or uninstall.
- # The contents is a list of items that will be installed or
+ # The contents is a list of items that will be installed or
# uninstalled. TODO: This could be improved by making it a "def"
sub_element = element.getchildren()
for sub in sub_element:
@@ -129,50 +128,50 @@
action = sub.get(IPSSpec.IPS_ACTION_LABEL)
if action is None:
action = IPSSpec.INSTALL
-
+
pkg_list = []
names = sub.getchildren()
-
+
for name in names:
pkg_list.append(name.text.strip('"'))
-
+
transfer_obj.action = action
transfer_obj.contents = pkg_list
elif val == "CPIO":
action = sub.get(CPIOSpec.CPIOSPEC_ACTION_LABEL)
transfer_obj = CPIOSpec()
-
+
# A file_list transfer is specified in the manifest.
names = sub.getchildren()
if len(names) > 0:
file_list = list()
-
+
for name in names:
file_list.append(name.text.strip('"'))
-
+
transfer_obj.contents = file_list
transfer_obj.action = action
-
+
elif val == "SVR4":
- action = sub.get(SVR4Spec.SVR4_ACTION_LABEL)
- transfer_obj = SVR4Spec()
-
- if action is None:
- action = "install"
+ action = sub.get(SVR4Spec.SVR4_ACTION_LABEL)
+ transfer_obj = SVR4Spec()
+
+ if action is None:
+ action = "install"
- pkg_list = []
- names = sub.getchildren()
- for name in names:
- pkg_list.append(name.text.strip('"'))
-
- transfer_obj.action = action
- transfer_obj.contents = pkg_list
-
+ pkg_list = []
+ names = sub.getchildren()
+ for name in names:
+ pkg_list.append(name.text.strip('"'))
+
+ transfer_obj.action = action
+ transfer_obj.contents = pkg_list
+
# Insert the transfer object as a child of the
# software checkpoint
chkpt_obj.insert_children([transfer_obj])
-
+
return chkpt_obj
@@ -658,7 +657,6 @@
'''
return False
-
@classmethod
def from_xml(cls, element):
'''Method to transfer the IPS checkpoint xml data to the data object
@@ -710,7 +708,7 @@
sub_element = etree.SubElement(element,
Software.SOFTWARE_NAME_LABEL)
sub_element.text = svr4_pkg
- return element
+ return element
@classmethod
def can_handle(cls, element):
@@ -719,7 +717,6 @@
'''
return False
-
@classmethod
def from_xml(cls, element):
'''Method to transfer the SVR4 checkpoint xml data to the data object
--- a/usr/src/lib/install_transfer/test/test_info.py Wed Apr 06 23:20:22 2011 -0600
+++ b/usr/src/lib/install_transfer/test/test_info.py Thu Apr 07 13:51:29 2011 -0600
@@ -406,7 +406,7 @@
pub = src_list[0].get_children("publisher", Publisher)
origin = pub[0].get_children("origin", Origin)
self.assertEqual(origin[0].origin,
- set "http://pkg.oracle.com/solaris/release")
+ "http://pkg.oracle.com/solaris/release")
dst_list = soft.get_children("destination", Destination)
self.assertEqual(len(dst_list), 1)