def __init__(self, element): ParserHelper.__init__(self) name = element.tagName.encode() if name != 'traits': raise Error, 'bad tag for TraitsParser' self.suite = element.getAttribute('suite').encode() self.trait_elements = element.getElementsByTagName('trait') self.traits = [e.getAttribute('name').encode() for e in self.trait_elements]
def __init__(self, element): ParserHelper.__init__(self) name = element.tagName.encode() if name != 'family': raise Error, 'bad tag: %s' % name self.name = element.getAttribute('name').encode() self.parents = self._parse_parents(element) self.environ = self._parse_environ(element)
def __init__(self, element): ParserHelper.__init__(self) name = element.tagName.encode() if name != 'profile': raise Error, 'bad tag for profileparser' self.name = element.getAttribute('name').encode() self.suite = element.getAttribute('suite').encode() self.traits = [] self._get_traits(element) self.vars = [] self._get_variables(element)
def __init__(self, element): ParserHelper.__init__(self) self.__desc__ = ['suite', 'nonus', 'updates', 'local', 'common'] name = element.tagName.encode() if name != 'suite': raise Error, 'bad tag fro SuiteParser' for att in self.__desc__: if att == 'suite': setattr(self, 'name', self.get_attribute(element, 'name')) setattr(self, 'suite', self.get_attribute(element, 'name')) else: setattr(self, att, self.get_attribute(element, att))
def __init__(self, element): ParserHelper.__init__(self) name = element.tagName.encode() get_em = self.get_elements_from_section self.kernels = map(get_child, get_em(element, 'kernels', 'kernel')) self.mounts = map(parse_mount, get_em(element, 'mounts', 'mount')) self.filesystems = map(self._parse_filesystem, get_em(element, 'filesystems', 'filesystem')) self.disks = map(self._parse_disk, get_em(element, 'disks', 'diskname')) self.mtypes = map(self._parse_mtype, get_em(element, 'machine_types', 'machine_type')) self.machines = map(parse_machine, get_em(element, 'machines', 'machine'))
def __init__(self, path): ParserHelper.__init__(self) f = file(path) self.xml = parse_file(f) f.close() name = self.xml.firstChild.tagName if name != 'profiles': raise Error, 'bad tag for ProfilesParser' element = self.xml.firstChild self.profile_elements = self.get_elements_from_section(self.xml, 'profiles', 'profile') self.profiles = [ProfileParser(element) for element in self.profile_elements]
def __init__(self, filename): ParserHelper.__init__(self) f = file(filename) self.xml = parse_file(f) f.close() if self.xml.firstChild.tagName != 'paelladatabase': raise Error, 'bad type of xmlfile for PaellaParser' self.db_element = self.xml.firstChild self.suite_elements = self.get_elements_from_section(self.db_element, 'suites', 'suite') self.suites = [SuiteParser(element) for element in self.suite_elements] children = [node for node in self.db_element.childNodes] traits_elements = [] for node in children: if hasattr(node, 'tagName') and node.tagName not in ['profiles', 'suites']: traits_elements.append(node) self.traits = [TraitsParser(element) for element in traits_elements]
def __init__(self, element): ParserHelper.__init__(self) name = element.tagName.encode() if name != 'trait': raise Error, 'bad tag' self.name = element.getAttribute('name').encode() self.suite = element.getAttribute('suite').encode() self.packages = {} self._get_packages(element) self.parents = [] self._get_parents(element) self.environ = {} self._get_environ(element) self.templates = {} self._get_templates(element) self.debconf = {} self._get_debconf(element) self.scripts = [] self._get_scripts(element)