author | Mary Ding <mary.ding@oracle.com> |
Fri, 03 Jun 2011 12:11:47 -0700 | |
changeset 1169 | 83735ef8ac29 |
parent 1168 | cc22970d63d0 |
child 1170 | e35493b6895c |
--- a/usr/src/cmd/auto-install/test/test_ai_sd.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/cmd/auto-install/test/test_ai_sd.py Fri Jun 03 12:11:47 2011 -0700 @@ -31,7 +31,7 @@ import time import unittest -import ai_sd +from solaris_install.auto_install import ai_sd class TestAISD(unittest.TestCase):
--- a/usr/src/lib/install_engine/test/engine_test_utils.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_engine/test/engine_test_utils.py Fri Jun 03 12:11:47 2011 -0700 @@ -22,7 +22,7 @@ # # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. # '''Some convenience functions that can be used by other test suites that use @@ -31,6 +31,7 @@ import os import logging +import shutil import solaris_install.engine as engine from solaris_install.logger import InstallLogger
--- a/usr/src/lib/install_transfer/ips.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_transfer/ips.py Fri Jun 03 12:11:47 2011 -0700 @@ -763,7 +763,8 @@ raise ValueError("The following components are specified " "twice in the manifest: %s" % str(overlap)) - # Update the image args with the current image args being processed. + # Update the image args with the current image args being + # processed. self.image_args.update(args.arg_dict) # Parse the transfer specific attributes.
--- a/usr/src/lib/install_utils/DefValProc.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/DefValProc.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,7 +19,7 @@ # # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # ============================================================================= # ============================================================================= @@ -69,6 +69,7 @@ DEFAULT_INVERT_VALUE = (DEFAULT_INVERT_VALUE_STR == "True") + # ============================================================================= # Error handling classes # ============================================================================= @@ -77,7 +78,6 @@ pass - # ============================================================================= class _HelperDicts: # ============================================================================= @@ -111,7 +111,6 @@ self.methods = method_dict self.inverts = invert_dict - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @staticmethod def new(defval_tree, nodepath): @@ -122,9 +121,10 @@ Args: defval_tree: Tree of defaults and validation nodes (TreeAccNodes) containing the information. This tree has been read in from the - defval manifest and contains references to the validator and default - setter methods and their host modules. It is assumed that the - methods are part of a class of the same name as their host module. + defval manifest and contains references to the validator and + default setter methods and their host modules. It is assumed that + the methods are part of a class of the same name as their host + module. nodepath: Root of tree branch containing information on helper methods of interest. For example, the part of the tree @@ -167,14 +167,14 @@ # Make sure the helper ref is unique. if ref in methods: - raise ManifestProcError, ("HelperDicts.new: helper ref " + - ref + " is not unique") + raise ManifestProcError(("HelperDicts.new: helper ref " + + ref + " is not unique")) # Get and validate module name. module_name = helper_attrs["module"] if not module_name.endswith(".py"): - raise ManifestProcError, ("HelperDicts.new: Invalid python " + - "helper module name: " + module_name) + raise ManifestProcError(("HelperDicts.new: Invalid python " + + "helper module name: " + module_name)) # Assume class is same name as the module it's in. class_name = module_name[:-3] @@ -312,8 +312,8 @@ "Validator terminated with status " + str(rval)) if (rval != 0): - raise ManifestProcError, ("validate_vs_schema: " + - "Validator terminated abnormally") + raise ManifestProcError(("validate_vs_schema: " + + "Validator terminated abnormally")) # Print extra error message here for OSErrors as unexpected. except OSError: @@ -360,9 +360,9 @@ # with the project manifest. At a minimum, the tops of the trees # should be the same. if (len(ancestor_node) == 0): - raise ManifestProcError, ("generate_ancestor_nodes: " + - "manifest and defval manifest " + - "are incompatible") + raise ManifestProcError(("generate_ancestor_nodes: " + + "manifest and defval manifest " + + "are incompatible")) # Iterate from the top of the nodepath, filling in nodes which are # missing. New nodes will have no value. @@ -377,8 +377,8 @@ current_node = [new_node] elif (len(current_node) > 1): - raise ManifestProcError, ("generate_ancestor_nodes: " + - "non-deterministic nodepath specified") + raise ManifestProcError(("generate_ancestor_nodes: " + + "non-deterministic nodepath specified")) ancestor_node = current_node @@ -418,9 +418,9 @@ if ((method_ref not in deflt_setter_dicts.modules) or (method_ref not in deflt_setter_dicts.methods)): - raise ManifestProcError, ("get_value_from_helper: Helper method " + - "ref %s missing from defval manifest file" % - method_ref) + raise ManifestProcError(("get_value_from_helper: Helper method " + + "ref %s missing from defval manifest file" % + method_ref)) module = deflt_setter_dicts.modules[method_ref] method = deflt_setter_dicts.methods[method_ref] @@ -747,8 +747,8 @@ node_type, parent_node) if errors: - raise ManifestProcError, ("One or more errors occured while " + - "setting defaults") + raise ManifestProcError(("One or more errors occured while " + + "setting defaults")) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -789,7 +789,7 @@ print >> sys.stderr, ("add_defaults: Error getting " + "default value from helper method for " + value_from_xml) - raise ManifestProcError, str(err) + raise ManifestProcError(str(err)) # Get the value from the defaults / validation manifest. elif (via == "value"): @@ -798,8 +798,8 @@ # Shouldn't get here if defaults / validation manifest # passed schema validation. else: - raise ManifestProcError, ("add_defaults: " + - 'Invalid "from" attribute = ' + via) + raise ManifestProcError(("add_defaults: " + + 'Invalid "from" attribute = ' + via)) return default_value @@ -836,9 +836,9 @@ method = validator_dicts.methods.get(validator_ref) if ((module is None) or (method is None)): - raise ManifestProcError, ("validate_node: Validator ref " + - validator_ref + - " missing from defval manifest file") + raise ManifestProcError(("validate_node: Validator ref " + + validator_ref + + " missing from defval manifest file")) if (validator_dicts.inverts is not None): invert = validator_dicts.inverts.get(validator_ref, @@ -1105,8 +1105,8 @@ print >> sys.stderr, str(err) errors = True if errors: - raise ManifestProcError, ("validate_singles: One or more validation " + - "errors found.") + raise ManifestProcError(("validate_singles: One or more validation " + + "errors found.")) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1171,8 +1171,8 @@ errors = True if errors: - raise ManifestProcError, ("validate_group: One or more validation " + - "errors found.") + raise ManifestProcError(("validate_group: One or more validation " + + "errors found.")) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1249,8 +1249,8 @@ curr_list = manifest_tree.walk_tree(walker) if errors: - raise ManifestProcError, ("validate_exclude: One or more validation " + - "errors found.") + raise ManifestProcError(("validate_exclude: One or more validation " + + "errors found.")) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1291,10 +1291,10 @@ try: defval_tree = TreeAcc(defval_xml) except TreeAccError, err: - raise ManifestProcError, ("init_defval_tree: " + - "Error creating tree for default " + - "and content validation manifest " + - defval_xml + ":" + str(err)) + raise ManifestProcError(("init_defval_tree: " + + "Error creating tree for default " + + "and content validation manifest " + + defval_xml + ":" + str(err))) return defval_tree @@ -1326,5 +1326,5 @@ dtd_schema=dtd_schema) except StandardError, err: print >> sys.stderr, str(err) - raise ManifestProcError, ("schema_validate: Schema validation " + - "failed for DC manifest " + in_dc_manifest) + raise ManifestProcError(("schema_validate: Schema validation " + + "failed for DC manifest " + in_dc_manifest))
--- a/usr/src/lib/install_utils/ENParser.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/ENParser.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,7 +19,7 @@ # # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # ============================================================================= # ============================================================================= @@ -36,10 +36,12 @@ # Declare new classes for errors thrown from this file's classes. # ============================================================================= + class ParserError(StandardError): """ Exceptions encountered or generated during parsing. """ pass + # ============================================================================= class ENToken(object): # ============================================================================= @@ -102,56 +104,56 @@ D C C C C D (value=v3) (value=v4) (value=v5) (value=v6) (value=v7) (value=v8) - In the simplest case, - A/B/C would return all 4 C nodes. - However, these functions allow specification of values to narrow down - the search: + In the simplest case, + A/B/C would return all 4 C nodes. + However, these functions allow specification of values to narrow down + the search: - Syntax: Path strings are broken into tokens on / not inside [] and not - inside quotes or double quotes. + Syntax: Path strings are broken into tokens on / not inside [] and not + inside quotes or double quotes. - Token syntax: - name=value | - name[valpath=value] | - name[valpath1=value1:valpath2=value2:...] + Token syntax: + name=value | + name[valpath=value] | + name[valpath1=value1:valpath2=value2:...] - String token parse_nodepath() - returns an ENToken - containing: - ---------------------------------------------------------------------- - A/B=v1/C A name:A - values: [] - valpaths: [] - ------------------------------------------------------ - B=v1 name:B - values: [v1] - valpaths: [] - ------------------------------------------------------ - C name:C - values: [] - valpaths: [] - ---------------------------------------------------------------------- - A[B/C=v5]/B=v1/D A[B/C=v5] name:A - values: [v5] - valpaths: [B/C] - ------------------------------------------------------ - B=v1 name:B - values: [v1] - valpaths: [] - ------------------------------------------------------ - D name:D - values: [] - valpaths: [] - ------------------------------------------------------ - ---------------------------------------------------------------------- - A[B/C=v6:B/D=v8]/B A[B/C=v6:B/D=v8] name:A - values: [v6, v8] - valpaths: [B/C, B/D] - ------------------------------------------------------ - name:B - values: [] - valpaths: [] - ---------------------------------------------------------------------- + String token parse_nodepath() + returns an ENToken + containing: + ---------------------------------------------------------------------- + A/B=v1/C A name:A + values: [] + valpaths: [] + ------------------------------------------------------ + B=v1 name:B + values: [v1] + valpaths: [] + ------------------------------------------------------ + C name:C + values: [] + valpaths: [] + ---------------------------------------------------------------------- + A[B/C=v5]/B=v1/D A[B/C=v5] name:A + values: [v5] + valpaths: [B/C] + ------------------------------------------------------ + B=v1 name:B + values: [v1] + valpaths: [] + ------------------------------------------------------ + D name:D + values: [] + valpaths: [] + ------------------------------------------------------ + ---------------------------------------------------------------------- + A[B/C=v6:B/D=v8]/B A[B/C=v6:B/D=v8] name:A + values: [v6, v8] + valpaths: [B/C, B/D] + ------------------------------------------------------ + name:B + values: [] + valpaths: [] + ---------------------------------------------------------------------- ENTokens can be passed to a search routine for use in finding appropriate matches. @@ -419,7 +421,7 @@ print >> sys.stderr, ("Unexpected Internal " + "IndexError: curr state:%d, curr char:%s" % ( curr_state, curr_char)) - raise ParserError, __MSG_PARSER_ERROR + raise ParserError(__MSG_PARSER_ERROR) # Non-special character. return __STATE_TABLE[curr_state].normal_char_next_state @@ -430,22 +432,22 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """Parse a token as returned from parse_path_into_tokens() - See module header for parsing syntax. + See module header for parsing syntax. - Args: - nodepath: nodepath to parse + Args: + nodepath: nodepath to parse - Returns: - A list of parsed tokens as ENTokens + Returns: + A list of parsed tokens as ENTokens - Raises: - ParserError: Mismatching brackets in path token - ParserError: ] before [ in path token - ParserError: Path cannot start with a / - ParserError: Quote mistmatch in path token - ParserError: Error parsing path token + Raises: + ParserError: Mismatching brackets in path token + ParserError: ] before [ in path token + ParserError: Path cannot start with a / + ParserError: Quote mistmatch in path token + ParserError: Error parsing path token - """ + """ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Initialize variables and lists to return, to empty values. @@ -558,7 +560,7 @@ pass # Starting slash received. Set appropriate error and bomb. - elif (new_state == __ST_STSL): + elif (new_state == __ST_STSL): error_msg = __MSG_STARTING_SLASH new_state = __ST_ERR @@ -581,13 +583,13 @@ if (new_state == __ST_ERR): if (error_msg is None): error_msg = __MSG_PARSER_ERROR - raise ParserError, error_msg + raise ParserError(error_msg) if (double_quote_active or single_quote_active): - raise ParserError, __MSG_QUOTE_MISMATCH + raise ParserError(__MSG_QUOTE_MISMATCH) if (bracket_active): - raise ParserError, __MSG_BKT_MISMATCH + raise ParserError(__MSG_BKT_MISMATCH) # No errors. Append the token in progress. if (token_in_progress):
--- a/usr/src/lib/install_utils/ManifestRead.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/ManifestRead.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,7 +19,7 @@ # # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # # ============================================================================= @@ -37,6 +37,7 @@ import osol_install.SocketServProtocol as SocketServProtocol + # ============================================================================= class ManifestRead(object): # ============================================================================= @@ -86,7 +87,6 @@ sock_name) raise - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __del__(self): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -108,7 +108,6 @@ except socket.error: pass - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def get_values(self, request, is_key=False): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -237,7 +236,6 @@ return results_list - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def set_debug(self, on_off): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- a/usr/src/lib/install_utils/ManifestServ.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/ManifestServ.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,7 +19,7 @@ # # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # # ============================================================================= @@ -53,10 +53,12 @@ # Declare new classes for errors thrown from this file's classes. # ============================================================================= + class ManifestServError(StandardError): """Base Exception for ManifestServ errors""" pass + # ============================================================================= class ManifestServ(object): # ============================================================================= @@ -232,7 +234,6 @@ self.temp_manifest_name, self.verbose, self.keep_temp_files) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def schema_validate(self, schema_name=None, temp_manifest_name=None, out_manifest_name=None, verbose=None, @@ -307,7 +308,8 @@ try: self.manifest_tree = TreeAcc(out_manifest_name) except TreeAccError: - print >> sys.stderr, "Error re-instantiating manifest tree:" + print >> sys.stderr, "Error re-instantiating manifest \ + tree:" raise except ManifestProcError, err: @@ -329,7 +331,6 @@ print ("Removing temporary file: " + out_manifest_name) os.unlink(out_manifest_name) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __load_defval_tree__(self, defval_manifest_name): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -359,7 +360,6 @@ print >> sys.stderr, str(err) raise - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def set_defaults(self, defval_manifest_name=None, temp_manifest_name=None, verbose=None, @@ -398,8 +398,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (self.dtd_schema): - raise ManifestServError, \ - ("set_defaults() called for DTD manifest") + raise ManifestServError(\ + ("set_defaults() called for DTD manifest")) if (defval_manifest_name is None): defval_manifest_name = self.defval_manifest_name @@ -425,7 +425,6 @@ self.__save_tree(temp_manifest_name) raise - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def semantic_validate(self, defval_manifest_name=None, temp_manifest_name=None, verbose=None, @@ -464,8 +463,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (self.dtd_schema): - raise ManifestServError, \ - ("semantic_validate() called for DTD manifest") + raise ManifestServError(\ + ("semantic_validate() called for DTD manifest")) if (defval_manifest_name is None): defval_manifest_name = self.defval_manifest_name @@ -492,7 +491,6 @@ self.__save_tree(temp_manifest_name) raise - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __save_tree(self, save_manifest): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -517,7 +515,6 @@ print >> sys.stderr, str(err) raise - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def start_socket_server(self, debug=False): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -545,8 +542,8 @@ thread.start_new_thread(self.__socket_server_main, ()) except thread.error, err: print >> sys.stderr, "Error starting socket server" - raise ManifestServError, ("Error starting socket server: %s" % - (str(err))) + raise ManifestServError(("Error starting socket server: %s" % + (str(err)))) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def stop_socket_server(self): @@ -593,7 +590,6 @@ except OSError: pass - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def get_values(self, request, is_key=False, verbose=False): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -640,7 +636,6 @@ str(strlist)) return strlist - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def get_sockname(self): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -662,7 +657,6 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return self.listen_sock_name - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __process_srvr_requests(self, srvsock): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -773,7 +767,6 @@ if (self.socket_debug): print "termination requested" - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __serve(self, srvsock): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -816,7 +809,6 @@ if (self.socket_debug): print "Terminating client-specific server thread" - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __socket_server_main(self): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- a/usr/src/lib/install_utils/SocketServProtocol.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/SocketServProtocol.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,7 +19,7 @@ # # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # ============================================================================= # ============================================================================= @@ -45,7 +45,7 @@ # strings) has been completed REQ_COMPLETE = '\002' - + # EMPTY_STR is sent instead of an empty string, when an empty string # would be returned as part of a request. This allows clients to use # split() on the results string, and to still be able to differentiate
--- a/usr/src/lib/install_utils/TreeAcc.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/TreeAcc.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,7 +19,7 @@ # # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # ============================================================================= # ============================================================================= @@ -44,38 +44,57 @@ # Declare new classes for errors thrown from this file's classes. # ============================================================================= + class FileOpenError(IOError): """Exception for errors opening files. """ pass + + class FileSaveError(IOError): """Exception for errors saving the xml tree. """ pass + class TreeAccError(StandardError): """Base exception for non-system errors.""" pass + + class PathNotUniqueError(TreeAccError): """Exception for when a given path needs to be unique but is not.""" pass + + class NodeNotFoundError(TreeAccError): """Exception for when a given path doesn't refer to an existing node.""" pass + + class NodeExistsError(TreeAccError): """Exception for when a given path refers to an existing node.""" pass + + class ParentNodeNotFoundError(TreeAccError): """Exception for when a parent node to a given path does not exist.""" pass + + class AmbiguousParentNodeError(TreeAccError): """Exception for when a given path could refer to multiple parents.""" pass + + class InvalidArgError(TreeAccError): """Exception for when an argument is invalid.""" pass + + class BadNodepathError(TreeAccError): """Exception for when a bad nodepath is passed or a parser error ensues.""" pass + # ============================================================================= class TreeAccNode: # ============================================================================= @@ -136,19 +155,19 @@ """ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (name is None): - raise InvalidArgError, ("TreeAccNode init: name cannot be None") + raise InvalidArgError(("TreeAccNode init: name cannot be None")) if ((node_type != TreeAccNode.ELEMENT) and (node_type != TreeAccNode.ATTRIBUTE)): - raise InvalidArgError, ("TreeAccNode init: invalid node type") + raise InvalidArgError(("TreeAccNode init: invalid node type")) if ((node_type == TreeAccNode.ATTRIBUTE) and (value is None)): - raise InvalidArgError, ("TreeAccNode init: " + - "missing attribute value") + raise InvalidArgError(("TreeAccNode init: " + + "missing attribute value")) if (element_node is None): - raise InvalidArgError, ("TreeAccNode init: " + - "missing element_node arg") + raise InvalidArgError(("TreeAccNode init: " + + "missing element_node arg")) self.__name = name self.__type = node_type @@ -164,7 +183,6 @@ else: self.__path = self.__path_to_parent() - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __eq__(self, other): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -191,7 +209,6 @@ rval = False return rval - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __ne__(self, other): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -211,7 +228,6 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return (not self.__eq__(other)) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Accessor methods # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -263,7 +279,6 @@ """ Return True or False that this node represents an ELEMENT. """ return (self.__type == TreeAccNode.ELEMENT) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __path_to_parent(self, attr_string=None): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -303,7 +318,6 @@ return path - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __repr__(self): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -410,7 +424,6 @@ attr_dict[attr_node.nodeName] = attr_node.nodeValue.strip() return attr_dict - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @staticmethod def __get_element_value(element_node): @@ -451,7 +464,7 @@ # if ((len(value) > 2) and (value[0] == value[-1]) and ((value[0] == "\"") or (value[0] == "'"))): - + # Remove middle escaped quote chars for comparison. non_esc = value.replace(("\\" + value[0]), "") @@ -462,7 +475,6 @@ return value - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @staticmethod def __pathlist_has_dots(path_tokens): @@ -486,9 +498,7 @@ return True return False - # Instance methods - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __init__(self, xml_file): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -509,11 +519,11 @@ try: self.treedoc = minidom.parse(xml_file.strip()) except IOError, err: - raise TreeAccError, ("Error opening xml file %s: %s" % - (xml_file.strip(), errno.errorcode[err.errno])) + raise TreeAccError(("Error opening xml file %s: %s" % + (xml_file.strip(), errno.errorcode[err.errno]))) except (DOMException, ExpatError), err: - raise TreeAccError, ("Error parsing xml file %s" % - (xml_file.strip())) + raise TreeAccError(("Error parsing xml file %s" % + (xml_file.strip()))) # Save root document element. self.treeroot = self.treedoc.documentElement @@ -526,7 +536,6 @@ TreeAccNode.ELEMENT, value, attrs, self.treeroot, self) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def find_node(self, path, starting_ta_node=None): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -564,8 +573,7 @@ return self.__find_node_w_pathlist(parse_nodepath(path), starting_ta_node) except ParserError, err: - raise BadNodepathError, "Error parsing nodepath: " + str(err) - + raise BadNodepathError("Error parsing nodepath: " + str(err)) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __find_node_w_pathlist(self, path_tokens, starting_ta_node=None): @@ -696,7 +704,6 @@ return found_nodes - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __search_node(self, curr_node, node_type, path_tokens, found_nodes, search_value): @@ -802,7 +809,6 @@ TreeAccNode.ATTRIBUTE, attr_node.nodeValue, attr_dict, curr_node, self)) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __match(self, token, curr_node, node_type): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -870,7 +876,6 @@ return None return token.name - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __is_bracket_match(self, curr_node, valpaths, values): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -953,7 +958,6 @@ return True - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __do_dots(self, path_tokens, curr_node, found_nodes, search_value): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1025,7 +1029,6 @@ # Return current DOM node in all cases. return curr_node - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def replace_value(self, path, new_value, starting_ta_node=None): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1062,13 +1065,13 @@ # No match. if (len(matches) == 0): - raise NodeNotFoundError, (("replace_value: node %s not " + - "found") % path) + raise NodeNotFoundError((("replace_value: node %s not " + + "found") % path)) # Multiple matches. if (len(matches) > 1): - raise PathNotUniqueError, (("replace_value: path %s matches " + - "multiple nodes") % path) + raise PathNotUniqueError((("replace_value: path %s matches " + + "multiple nodes") % path)) # Get the DOM element node of the one match. If the target # is an attribute, retrieve the element node that attribute is @@ -1087,7 +1090,6 @@ # Change the element value. self.__set_element_value(element_node, new_value) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def add_node(self, path, value, node_type, starting_ta_node=None, is_unique=True): @@ -1136,20 +1138,19 @@ # Type must be an ELEMENT or an ATTRIBUTE if ((node_type != TreeAccNode.ELEMENT) and (node_type != TreeAccNode.ATTRIBUTE)): - raise InvalidArgError, "invalid type specified" + raise InvalidArgError("invalid type specified") # Enforce arg restrictions applicable when adding attributes. if (node_type == TreeAccNode.ATTRIBUTE): if (value is None): - raise InvalidArgError, ("add_node: missing attribute value") + raise InvalidArgError(("add_node: missing attribute value")) if (not is_unique): - raise InvalidArgError, ("add_node: is_unique must be True " + - "when adding attributes") + raise InvalidArgError(("add_node: is_unique must be True " + + "when adding attributes")) path_tokens = parse_nodepath(path) if (len(path_tokens) == 0): - raise InvalidArgError, ( - "add_node: provided path is empty") + raise InvalidArgError(("add_node: provided path is empty")) # Note: can have non-unique attribute paths, as can have same # attribute on sibling elements, e.g. two users both have @@ -1167,8 +1168,8 @@ # Have at least one match for an existing node. if (len(matches) > 0): if (is_unique): - raise NodeExistsError, ("add_node: Node with given " + - "path %s exists" % path) + raise NodeExistsError(("add_node: Node with given " + + "path %s exists" % path)) # More than one match. # OK if all matching nodes have a comment parent. @@ -1183,12 +1184,12 @@ if (parent_element is not matches[i].get_element_node(). parentNode): - raise AmbiguousParentNodeError, (("add_node: " + - "multiple nodes " + - "matching %s " + - "don't have " + - "common parent") % - path) + raise AmbiguousParentNodeError((("add_node: " + + "multiple nodes " + + "matching %s " + + "don't have " + + "common parent") % + path)) # Strip off the last part of the path. Save the result as the # parent. Save the stripped part as the name of the new element @@ -1212,12 +1213,12 @@ matches = self.__find_node_w_pathlist(parent_path_tokens, starting_ta_node) if (len(matches) == 0): - raise ParentNodeNotFoundError, ("add_node: parent node to " + - "%s not found" % path) + raise ParentNodeNotFoundError(("add_node: parent node to " + + "%s not found" % path)) if (len(matches) > 1): - raise AmbiguousParentNodeError, (("add_node: multiple nodes " + - "matching %s don't have " + - "common parent") % path) + raise AmbiguousParentNodeError((("add_node: multiple nodes " + + "matching %s don't have " + + "common parent") % path)) # No conflicts. Do it. parent_element = matches[0].get_element_node() @@ -1243,7 +1244,6 @@ return TreeAccNode(new_name, TreeAccNode.ELEMENT, value, {}, new_element, self) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def get_tree_walker(self): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1264,7 +1264,6 @@ return TreeWalker(self.__get_tree_walker_worker(self.treeroot), self.treeroot) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __get_tree_walker_worker(self, curr_node): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1292,7 +1291,6 @@ for child_gen in self.__get_tree_walker_worker(child): yield child_gen - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def walk_tree(self, tree_walker): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1321,7 +1319,6 @@ tree_walker.curr_node = None return self.get_treeaccnode_clust_fm_elem(ret_node) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def save_tree(self, out_file): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1346,7 +1343,7 @@ try: fp = open(out_file, "w") except IOError, err: - raise FileOpenError, errno.errorcode[err.errno] + raise FileOpenError(errno.errorcode[err.errno]) # If the original document contained a reference to an external # DTD, then reconstruct the DOCTYPE field and write it out at @@ -1368,7 +1365,7 @@ indent="", newl="")) fp.write("\n") except IOError, err: - raise FileSaveError, errno.errorcode[err.errno] + raise FileSaveError(errno.errorcode[err.errno]) finally: # Ignore errors on close. @@ -1377,7 +1374,6 @@ except IOError: pass - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def get_treeaccnode_from_element(self, element_node): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1406,7 +1402,6 @@ return TreeAccNode(name, TreeAccNode.ELEMENT, value, attrs, element_node, self) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def get_treeaccnode_clust_fm_elem(self, element_node): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- a/usr/src/lib/install_utils/__init__.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/__init__.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,11 +19,10 @@ # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. """ Module body for osol_install package """ __all__ = ["DefValProc", "ENParser", "TreeAcc", "install_utils", "ManifestServ", "ManifestRead", "SocketServProtocol", "errsvc"] -
--- a/usr/src/lib/install_utils/install_utils.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/install_utils.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,7 +19,7 @@ # # CDDL HEADER END # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # import sys @@ -194,7 +194,7 @@ if (len(word) != 0): outlist.append(word.strip()) word = "" - + # Escaped double quote elif (next_state == __QST_DQT): if (squoteon): @@ -217,7 +217,7 @@ # Done looping. Handle the case of residual mismatched quotes or # double-quotes. if ((squoteon) or (dquoteon)): - raise Exception, "Unexpected unescaped quote found: " + input_str + raise Exception("Unexpected unescaped quote found: " + input_str) # Handle the case where the \ is the last character of the input_str. if (state == __QST_ESC): @@ -305,8 +305,8 @@ elif (mode == "w"): mode = "a" elif (mode != "r"): - raise IOError, (errno.EINVAL, os.strerror(errno.EINVAL) + - ": " + "mode") + raise IOError((errno.EINVAL, os.strerror(errno.EINVAL) + + ": " + "mode")) dummy = os.stat(filename) # Check for file existance. dummy = open(filename, mode) # Check for file permissions. @@ -329,7 +329,7 @@ not specified, it will default to DEBUG stderr_log_level: Logging level for the stderr of each command. If not specified, it will default to ERROR - discard_stdout: If set to True, discard stdout + discard_stdout: If set to True, discard stdout Returns: The return value of the command executed. @@ -341,7 +341,7 @@ if (stdout_log_level is None): stdout_log_level = DEBUG - + if (stderr_log_level is None): stderr_log_level = ERROR @@ -361,7 +361,7 @@ log_msg = "exec command: " + string.join(cmd) if len(log_msg) > 200: - log_msg += "\n" + log_msg += "\n" if log is not None: log.log(stdout_log_level, log_msg) @@ -519,8 +519,8 @@ if ((path_type is not None) and (path_type != "dir") and (path_type != "file")): - raise Exception, ("find: \"path_type\" must be None, " + - "\"dir\" or \"file\"") + raise Exception(("find: \"path_type\" must be None, " + + "\"dir\" or \"file\"")) if (raise_errors): error_handler = __find_error_handler @@ -579,6 +579,7 @@ rlist.append(fullname) return rlist + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def file_size(filename): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -616,6 +617,7 @@ else: return (((stat.st_size / 1024) + 1) * 1024) + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def dir_size(rootpath): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -652,7 +654,7 @@ size += file_size(rootpath) if (size == 0): # This indicates the root directory is not valid - raise Exception, (rootpath + "is not valid") + raise Exception((rootpath + "is not valid")) for root, subdirs, files in os.walk(rootpath): # There's no need to distinguish between directories and @@ -672,6 +674,7 @@ return (size) + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def validate_crypt_id(val, alt_root=None): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -691,7 +694,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ try: - crypt_conf_file="/etc/security/crypt.conf" + crypt_conf_file = "/etc/security/crypt.conf" if alt_root is not None: crypt_conf_file = alt_root + crypt_conf_file with open(crypt_conf_file, 'r') as crypt_conf: @@ -712,6 +715,7 @@ # the set [a-zA-Z0-9./] SALT_CHAR_SET = string.ascii_letters + string.digits + "./" + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def crypt_gensalt(alt_root=None): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -785,6 +789,7 @@ return (salt + two_random_chars) + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def encrypt_password(plaintext, salt=None, alt_root=None): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -795,7 +800,8 @@ plaintext: password string in plaintext salt: salt to be used for the encryption. If none is provided, a salt will be generated. - alt_root: Alternate root to find configuration files for seed generation + alt_root: Alternate root to find configuration files for seed + generation Returns: The encrypted password string @@ -830,6 +836,7 @@ else: return inspect.getargspec(func.__call__) + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def set_http_proxy(proxy): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- a/usr/src/lib/install_utils/test/test_manifest_serv.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/install_utils/test/test_manifest_serv.py Fri Jun 03 12:11:47 2011 -0700 @@ -19,15 +19,17 @@ # # CDDL HEADER END # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. # ''' To run these tests, see the instructions in usr/src/tools/tests/README. Remember that since the proto area is used for the PYTHONPATH, the gate must be rebuilt for these tests to pick up any changes in the tested code. -Note: the XML and DTD files are picked up from usr/src/cmd/auto-install -and not the proto area. +Note: the XML files are picked up from usr/src/cmd/auto-install and not the +proto area. +Note: the DTD files are picked up from usr/src/install_manifest/dtd and not +the proto area. ''' import gettext @@ -40,6 +42,7 @@ # This is the path for the Manifest and Schema files. # It is relative to usr/src in the current workspace. XML_DIR="cmd/auto-install" +DTD_DIR="lib/install_manifest/dtd" class DTDManifest(unittest.TestCase): @@ -63,7 +66,7 @@ self.assertRaises(ManifestProcError, self.man_serv.schema_validate, - schema_name="%s/ai.dtd" % XML_DIR, + schema_name="%s/ai.dtd" % DTD_DIR, dtd_schema=False) def test_validate_succeeds_if_dtd_schema_is_true(self): @@ -71,7 +74,7 @@ try: self.man_serv.schema_validate( - schema_name="%s/ai.dtd" % XML_DIR, + schema_name="%s/ai.dtd" % DTD_DIR, dtd_schema=True) except ManifestProcError, err: self.fail("schema_validate unexpectedly failed: [%s]" % str(err))
--- a/usr/src/lib/terminalui/window_area.py Fri Jun 03 09:29:47 2011 -0700 +++ b/usr/src/lib/terminalui/window_area.py Fri Jun 03 12:11:47 2011 -0700 @@ -37,9 +37,11 @@ columns -> width y_loc -> START y location x_loc -> START x location - scrollable_lines -> Size of the vertical scroll area of this WindowArea. + scrollable_lines -> Size of the vertical scroll area of this + WindowArea. This attribute is only relevant for ScrollWindows - scrollable_columns -> Size of the horizontal scroll area of this WindowArea. + scrollable_columns -> Size of the horizontal scroll area of this + WindowArea. This attribute is only relevant for ScrollWindows '''