def process(self, func_name, node, xml_path, node_path, params): _, result = super(ProcessOneormore, self).process( func_name, node, xml_path, node_path, params) if type(result) is int: child = list(self.node)[0] for i in xrange(result): xml_gen.parse_node(child, params=self.params) elif result is not None: logging.error("OneOrMore should return an int, but %s found", type(result)) return self.cont, None
def process(self, func_name, node, xml_path, node_path, params): _, result = super(ProcessOneormore, self).process(func_name, node, xml_path, node_path, params) if type(result) is int: child = list(self.node)[0] for i in xrange(result): xml_gen.parse_node(child, params=self.params) elif result is not None: logging.error("OneOrMore should return an int, but %s found", type(result)) return self.cont, None
def process(self, func_name, node, xml_path, node_path, params): self.choices = [] super(ProcessChoice, self).process(func_name, node, xml_path, node_path, params) if not self.choices: return self.cont, None choice = random.choice(self.choices) return self.cont, xml_gen.parse_node(choice, params=self.params)
def process(self, func_name, node, xml_path, node_path, params): self.choices = [] super(ProcessChoice, self).process( func_name, node, xml_path, node_path, params) if not self.choices: return self.cont, None choice = random.choice(self.choices) return self.cont, xml_gen.parse_node(choice, params=self.params)
def domain_optional(self): # TODO: Move to other place if self.node.find("./ref[@name='qemucmdline']") is None: return self.go_on() controller = self.xml.find("./devices/controller[@type='pci']") if controller is None: node = self.nodetree.find("./define[@name='pciController']") params = { 'xml_stack': [], 'node_stack': [], 'nodetree': self.nodetree, } pcinode = xml_gen.parse_node(node, params=params) self.xml.find("./devices").append(pcinode)