Beispiel #1
0
    def __load(self, filename, uuid_be_dic=None):
        """Loads the history from a file located in self.path/history/
                {filename}.  The file should contain a serialized history
                object in XML format.
                """

        # Ensure all previous information is discarded.
        self.clear()

        try:
            if not uuid_be_dic:
                uuid_be_dic = bootenv.BootEnv.get_uuid_be_dic()
        except apx.ApiException as e:
            uuid_be_dic = {}

        try:
            pathname = os.path.join(self.path, filename)
            d = xmini.parse(pathname)
            root = d.documentElement
            for cnode in root.childNodes:
                if cnode.nodeName == "client":
                    self.__load_client_data(cnode)
                elif cnode.nodeName == "operation":
                    # Operations load differently due to
                    # the stack.
                    self.__operations.append({
                        "pathname":
                        pathname,
                        "operation":
                        self.__load_operation_data(cnode, uuid_be_dic)
                    })
        except KeyboardInterrupt:
            raise
        except Exception as e:
            raise apx.HistoryLoadException(e)
Beispiel #2
0
    def notes(self):
        """Generates the lines of release notes for this operation.
                If no release notes are present, no output occurs."""

        if not self.operation_release_notes:
            return
        try:
            rpath = os.path.join(self.root_dir, "notes",
                                 self.operation_release_notes)
            for a in file(rpath, "r"):
                yield a.rstrip()

        except Exception as e:
            raise apx.HistoryLoadException(e)