def parseSoftware(self, result, node): """Parse the <software> section of a submission.""" parsers = { "lsbrelease": self.parseLSBRelease, "packages": self.parsePackages, } for child in node.getchildren(): parser = parsers.get(child.tag) if parser: parser(result, child) else: self.logger.debug("Unsupported tag <%s> in <software>" % child.tag)
def parseSoftware(self, result, node): """Parse the <software> section of a submission.""" parsers = { "lsbrelease": self.parseLSBRelease, "packages": self.parsePackages, } for child in node.getchildren(): parser = parsers.get(child.tag) if parser: parser(result, child) else: self.logger.debug( "Unsupported tag <%s> in <software>" % child.tag)
def parseRoot(self, result, node): """Parse the <system> root of a submission.""" parsers = { "context": self.parseContext, "hardware": self.parseHardware, "questions": self.parseQuestions, "software": self.parseSoftware, "summary": self.parseSummary, } # Iterate over the root children, "summary" first for child in node.getchildren(): parser = parsers.get(child.tag) if parser: parser(result, child) else: self.logger.debug( "Unsupported tag <%s> in <system>" % child.tag)
def parseRoot(self, result, node): """Parse the <system> root of a submission.""" parsers = { "context": self.parseContext, "hardware": self.parseHardware, "questions": self.parseQuestions, "software": self.parseSoftware, "summary": self.parseSummary, } # Iterate over the root children, "summary" first for child in node.getchildren(): parser = parsers.get(child.tag) if parser: parser(result, child) else: self.logger.debug("Unsupported tag <%s> in <system>" % child.tag)
def addContext(self, text, command=None): if text.strip() == "Command not found.": return self.dispatcher.publishEvent( "attachment", {"name": command, "content": text }) parsers = { "cat /proc/cpuinfo": self.parseCpuinfo, "cat /proc/meminfo": self.parseMeminfo, "dmidecode": DmidecodeParser, "udevadm info --export-db": self.parseUdevadm, } parser = parsers.get(command) if parser: if not isinstance(text, unicode): text = text.decode("utf-8") stream = StringIO(text) p = parser(stream) p.run(self)
def parseSummary(self, result, node): """Parse the <summary> section of a submission.""" parsers = { "architecture": self._getValueAsString, "client": self._getClient, "contactable": self._getValueAsBoolean, "date_created": self._getValueAsDatetime, "distribution": self._getValueAsString, "distroseries": self._getValueAsString, "kernel-release": self._getValueAsString, "live_cd": self._getValueAsBoolean, "private": self._getValueAsBoolean, "system_id": self._getValueAsString, } for child in node.getchildren(): parser = parsers.get(child.tag) if parser: value = parser(child) result.addSummary(child.tag, value) else: self.logger.debug( "Unsupported tag <%s> in <summary>" % child.tag)
def parseHardware(self, result, node): """Parse the <hardware> section of a submission.""" parsers = { "dmi": DmidecodeParser, "processors": self.parseProcessors, "udev": result.parseUdevadm, } for child in node.getchildren(): parser = parsers.get(child.tag) if parser: if child.getchildren(): parser(result, child) else: text = child.text if hasattr(text, "decode"): text = text.decode("utf-8") stream = StringIO(text) p = parser(stream) p.run(result) else: self.logger.debug( "Unsupported tag <%s> in <hardware>" % child.tag)
def parseSummary(self, result, node): """Parse the <summary> section of a submission.""" parsers = { "architecture": self._getValueAsString, "client": self._getClient, "contactable": self._getValueAsBoolean, "date_created": self._getValueAsDatetime, "distribution": self._getValueAsString, "distroseries": self._getValueAsString, "kernel-release": self._getValueAsString, "live_cd": self._getValueAsBoolean, "private": self._getValueAsBoolean, "system_id": self._getValueAsString, } for child in node.getchildren(): parser = parsers.get(child.tag) if parser: value = parser(child) result.addSummary(child.tag, value) else: self.logger.debug("Unsupported tag <%s> in <summary>" % child.tag)
def parseHardware(self, result, node): """Parse the <hardware> section of a submission.""" parsers = { "dmi": DmidecodeParser, "processors": self.parseProcessors, "udev": result.parseUdevadm, } for child in node.getchildren(): parser = parsers.get(child.tag) if parser: if child.getchildren(): parser(result, child) else: text = child.text if hasattr(text, "decode"): text = text.decode("utf-8") stream = StringIO(text) p = parser(stream) p.run(result) else: self.logger.debug("Unsupported tag <%s> in <hardware>" % child.tag)