コード例 #1
0
ファイル: base.py プロジェクト: yubihong/anaconda
    def read_kickstart(self, s):
        """Read the given kickstart string.

        The kickstart string should contain only commands and
        sections that are defined by the kickstart specification.

        :param s: a kickstart string
        :return: a kickstart report
        """
        log.debug("Reading kickstart...")
        report = KickstartReport()

        try:
            handler = self.get_kickstart_handler()
            parser = self.get_kickstart_parser(handler)

            with warnings.catch_warnings(record=True) as warns:
                warnings.simplefilter(action="always",
                                      category=KickstartParseWarning)

                parser.readKickstartFromString(s)
                self.process_kickstart(handler)

                for warn in warns:
                    if issubclass(warn.category, KickstartParseWarning):
                        data = KickstartMessage.for_warning(str(warn))
                        report.warning_messages.append(data)

        except KickstartError as e:
            data = KickstartMessage.for_error(e)
            report.error_messages.append(data)
        else:
            self.kickstarted = True

        return report
コード例 #2
0
    def read_kickstart_file(self, path):
        """Read the specified kickstart file.

        :param path: a path to a file
        :returns: a kickstart report
        """
        report = KickstartReport()

        try:
            elements = self._split_to_elements(path)
            reports = self._distribute_to_modules(elements)
        except KickstartError as e:
            data = KickstartMessage.for_error(e)
            data.module_name = BOSS.service_name
            data.file_name = path
            report.error_messages.append(data)
        else:
            self._merge_module_reports(report, reports)

        return report
コード例 #3
0
ファイル: base.py プロジェクト: skycastlelily2/anaconda
    def read_kickstart(self, s):
        """Read the given kickstart string.

        The kickstart string should contain only commands and
        sections that are defined by the kickstart specification.

        :param s: a kickstart string
        :return: a kickstart report
        """
        log.debug("Reading kickstart...")
        report = KickstartReport()

        try:
            handler = self.get_kickstart_handler()
            parser = self.get_kickstart_parser(handler)
            parser.readKickstartFromString(s)
            self.process_kickstart(handler)
        except KickstartError as e:
            data = KickstartMessage.for_error(e)
            report.error_messages.append(data)
        else:
            self.kickstarted = True

        return report