def set_machine_type(self, machine_type): clause = Eq('machine_type', machine_type) self.clear_body() title = SimpleTitleElement('MachineType: %s' % machine_type, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(TextElement('h1', 'Machine Disks')) rows = self.cursor.select(table='machine_disks', clause=clause) fields = ['diskname', 'device'] disktable = self._make_table(fields, rows) disktable.header.firstChild.setAttribute('bgcolor', 'cornsilk3') self.body.appendChild(disktable) modrows = self.cursor.select(table='machine_modules', clause=clause, order=['ord']) if len(modrows): self.body.appendChild(TextElement('h1', 'Machine Modules')) modtable = self._make_table(['module', 'ord'], modrows) modtable.header.firstChild.setAttribute('bgcolor', 'cornsilk3') self.body.appendChild(modtable) self._make_footer_anchors('machine_type', machine_type)
def set_filesystem(self, filesystem): clause = Eq('filesystem', filesystem) self.clear_body() title = SimpleTitleElement('Filesystem: %s' % filesystem, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(TextElement('h2', 'Filesystem Mounts')) rows = self.cursor.select(table='filesystem_mounts', clause=clause, order=['ord']) fields = ['mnt_name', 'partition', 'ord'] mounttable = self._make_table(fields, rows, bgcolor='DarkSeaGreen') self.body.appendChild(mounttable) self._make_footer_anchors('filesystem', filesystem)
def __init__(self, conn, suite): self.conn = conn self.cursor = StatementCursor(self.conn, name='_Trait_') Element.__init__(self, 'trait') self.desc_element = TextElement('description', None) self.parent_element = Element('parents') self.pkg_element = Element('packages') self.env_element = Element('environ') self.templ_element = Element('templates') self.scripts_element = Element('scripts') self.appendChild(self.desc_element) self.appendChild(self.parent_element) self.appendChild(self.pkg_element) self.appendChild(self.env_element) self.appendChild(self.templ_element) self.appendChild(self.scripts_element) self.set_suite(suite)