Esempio n. 1
0
    def set_family(self, family):
        self.family.set_family(family)
        parents = self.family.parents()
        erows = self.family.environment_rows()
        self.clear_body()
        title = SectionTitle('Family:  %s' % family)
        title['bgcolor'] = 'IndianRed'
        title['width'] = '100%'

        self.body.append(title)
        parent_anchor = Anchor('Parents', href='edit.parents.%s' % family)
        self.body.append(SectionTitle(parent_anchor))
        if len(parents):
            plist = UnorderedList()
            for p in parents:
                plist.append(ListItem(p))
            self.body.append(plist)
        vtitle = Anchor('Variables',
                        href='edit.variables.%s' % self.family.current)
        self.body.append(SectionTitle(vtitle))
        if len(erows):
            self.body.append(PVarTable(erows, bgcolor='MistyRose2'))
        self.body.append(Ruler())
        del_anchor = Anchor('delete', href='delete.family.%s' % family)
        self.body.append(del_anchor)
Esempio n. 2
0
 def set_profile(self, profile):
     self.clear_body()
     self.profile.set_profile(profile)
     title = SimpleTitleElement('Profile:  %s' % profile,
                                bgcolor='IndianRed',
                                width='100%')
     self.body.appendChild(title)
     rows = self.profile.get_trait_rows()
     ptitle = Anchor('edit.traits.%s' % self.profile.current.profile,
                     'Traits')
     self.body.appendChild(SectionTitle(ptitle))
     #self.body.appendChild(SectionTitle('Traits'))
     if len(rows):
         self.body.appendChild(TraitTable(rows, bgcolor='IndianRed1'))
     vtitle = Anchor('edit.variables.%s' % self.profile.current.profile,
                     'Variables')
     self.body.appendChild(SectionTitle(vtitle))
     erows = self.profile._env.get_rows()
     if len(erows):
         self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2'))
     etitle = Anchor('edit.families.%s' % self.profile.current.profile,
                     'Families')
     self.body.appendChild(SectionTitle(etitle))
     families = self.profile.get_families()
     flist = UnorderedList()
     for f in families:
         flist.appendChild(ListItem(f))
     self.body.appendChild(flist)
Esempio n. 3
0
 def _setup_section(self, name, fields, rows):
     title = SectionTitle(name)
     title.set_font(color='DarkViolet')
     anchor = Anchor('new', href='new.%s.mtype' % name)
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(rows):
         table = self._make_table(name, fields, rows, border=1, cellspacing=1)
         color_header(table, 'MediumOrchid2')
         self.body.append(table)
Esempio n. 4
0
 def _setup_section(self, name, fields, rows):
     title = SectionTitle(name, bgcolor=self._bgcolor_section)
     title.set_font(color=self._other_section_font_color)
     anchor = Anchor('new', href='new.%s.machine' % name)
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(rows):
         table = self._make_table(name, fields, rows, border=1, cellspacing=1)
         color_header(table, self._bgcolor_thead)
         self.body.append(table)
Esempio n. 5
0
 def _setup_section(self, name, fields, rows):
     title = SectionTitle(name, bgcolor=self._bgcolor_section)
     title.set_font(color=self._other_section_font_color)
     anchor = Anchor('new', href='new.%s.machine' % name)
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(rows):
         table = self._make_table(name, fields, rows, border=1, cellspacing=1)
         color_header(table, self._bgcolor_thead)
         self.body.append(table)
Esempio n. 6
0
 def _setup_variables_section(self, rows):
     section = 'Variables'
     machine = self.machine.current_machine
     relation = self.machine.relation
     # make the section
     title = SectionTitle(section, bgcolor=self._bgcolor_section)
     title.set_font(color=self._other_section_font_color)
     anchor = Anchor('new', href='new.%s.machine' % section)
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(rows):
         table = self._make_variables_table(rows, border=1, cellspacing=1)
         color_header(table, self._bgcolor_thead)
         self.body.append(table)
Esempio n. 7
0
 def _setup_section(self, name, fields, rows):
     title = SectionTitle(name)
     title.set_font(color='DarkViolet')
     anchor = Anchor('new', href='new.%s.mtype' % name)
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(rows):
         table = self._make_table(name,
                                  fields,
                                  rows,
                                  border=1,
                                  cellspacing=1)
         color_header(table, 'MediumOrchid2')
         self.body.append(table)
Esempio n. 8
0
 def _setup_variables_section(self, rows):
     section = 'Variables'
     machine = self.machine.current_machine
     relation = self.machine.relation
     # make the section
     title = SectionTitle(section, bgcolor=self._bgcolor_section)
     title.set_font(color=self._other_section_font_color)
     anchor = Anchor('new', href='new.%s.machine' % section)
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(rows):
         table = self._make_variables_table(rows, border=1, cellspacing=1)
         color_header(table, self._bgcolor_thead)
         self.body.append(table)
Esempio n. 9
0
    def set_machine_type(self, machine_type):
        clause = Eq('machine_type', machine_type)
        self.clear_body()
        self.mtype.set_machine_type(machine_type)
        title = SectionTitle('Machine Type:  %s' % machine_type)
        title['bgcolor'] = 'IndianRed'
        title['width'] = '100%'
        self.body.append(title)

        rows = self.cursor.select(table='machine_disks', clause=clause)
        self._setup_section('Disks', ['diskname', 'device'], rows)
        modrows = self.cursor.select(table='machine_modules',
                                     clause=clause,
                                     order=['ord'])
        self._setup_section('Modules', ['module', 'ord'], modrows)
        famrows = self.cursor.select(table='machine_type_family',
                                     clause=clause,
                                     order='family')
        self._setup_section('Families', ['family'], famrows)
        scripts = self.cursor.select(table='machine_type_scripts',
                                     clause=clause,
                                     order='script')
        self._setup_section('Scripts', ['script'], scripts)
        vars_ = self.cursor.select(table='machine_type_variables',
                                   clause=clause,
                                   order=['trait', 'name'])
        self._setup_section('Variables', ['trait', 'name', 'value'], vars_)
        self._make_footer_anchors('machine_type', machine_type)
Esempio n. 10
0
 def set_clause(self, clause):
     print 'clause---->', clause, type(clause)
     self.clear_body()
     title = SectionTitle('Machines')
     title['bgcolor'] = 'IndianRed'
     title['width'] = '100%'
     self.body.append(title)
     for row in self.machine.cursor.select(clause=clause):
         self.body.append(MachineFieldTable(row, bgcolor='MistyRose3'))
         self.body.append(Ruler())
Esempio n. 11
0
 def set_family(self, family):
     self.family.set_family(family)
     parents = self.family.parents()
     erows = self.family.environment_rows()
     self.clear_body()
     title = SimpleTitleElement('Family:  %s' % family,
                                bgcolor='IndianRed',
                                width='100%')
     self.body.appendChild(title)
     self.body.appendChild(SectionTitle('Parents'))
     if len(parents):
         plist = UnorderedList()
         for p in parents:
             plist.appendChild(ListItem(p))
         self.body.appendChild(plist)
     vtitle = Anchor('edit.variables.%s' % self.family.current, 'Variables')
     self.body.appendChild(SectionTitle(vtitle))
     if len(erows):
         self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2'))
Esempio n. 12
0
 def _setup_script_section(self):
     machine = self.machine.current_machine
     relation = self.machine.relation
     scriptnames = relation.scripts.scriptnames
     scripts = []
     for scriptname in scriptnames:
         result = relation.get_script(scriptname, show_inheritance=True)
         if result is not None:
             # if result is not None, then result is a tuple
             # that is (fileobj, parent)
             # but we need scriptname, parent
             scripts.append((scriptname, result[1]))
     # make the section
     title = SectionTitle('Scripts', bgcolor=self._bgcolor_section)
     title.set_font(color=self._other_section_font_color)
     anchor = Anchor('new', href='new.%s.machine' % 'Scripts')
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(scripts):
         table = self._make_script_table(scripts, border=1, cellspacing=1)
         color_header(table, self._bgcolor_thead)
         self.body.append(table)
Esempio n. 13
0
 def set_machine(self, machine):
     self.machine.set_machine(machine)
     self.clear_body()
     title = SectionTitle('Machine:  %s' % machine)
     title['bgcolor'] = self._bgcolor_section
     title['width'] = '100%'
     self.body.append(title)
     #mtable = Table()
     self._setup_parent_table()
     self._setup_main_attributes()
     self._setup_relation_sections()
     self._make_footer_anchors('machine', machine)
     return
Esempio n. 14
0
 def _setup_script_section(self):
     machine = self.machine.current_machine
     relation = self.machine.relation
     scriptnames = relation.scripts.scriptnames
     scripts = []
     for scriptname in scriptnames:
         result = relation.get_script(scriptname, show_inheritance=True)
         if result is not None:
             # if result is not None, then result is a tuple
             # that is (fileobj, parent)
             # but we need scriptname, parent
             scripts.append((scriptname, result[1]))
     # make the section
     title = SectionTitle('Scripts', bgcolor=self._bgcolor_section)
     title.set_font(color=self._other_section_font_color)
     anchor = Anchor('new', href='new.%s.machine' % 'Scripts')
     title.row.append(TableCell(anchor))
     self.body.append(title)
     if len(scripts):
         table = self._make_script_table(scripts, border=1, cellspacing=1)
         color_header(table, self._bgcolor_thead)
         self.body.append(table)
Esempio n. 15
0
    def set_profile(self, profile):
        self.clear_body()
        self.profile.set_profile(profile)
        suite = self.profile.current.suite
        maintitle_text = 'Profile:  %s' % profile
        #ptitle.append('(suite ')
        #ptitle.append(Anchor(suite, href='change.suite.%s' % suite))
        #ptitle.append(')')
        #title = SectionTitle('Profile:  %s   (suite %s) ' % (profile, suite))
        title = SectionTitle(maintitle_text)
        title['bgcolor'] = 'IndianRed'
        title['width'] = '100%'
        title.cell.append('  (suite ')
        title.cell.append(Anchor(suite, href='change.suite.%s' % suite))
        title.cell.append(')')

        self.body.append(title)
        rows = self.profile.get_trait_rows()
        ptitle = Anchor('Traits',
                        href='edit.traits.%s' % self.profile.current.profile)
        self.body.append(SectionTitle(ptitle))
        if len(rows):
            self.body.append(TraitTable(rows, bgcolor='IndianRed1'))
        vtitle = Anchor('Variables',
                        href='edit.variables.%s' %
                        self.profile.current.profile)
        self.body.append(SectionTitle(vtitle))
        erows = self.profile._env.get_rows()
        if len(erows):
            self.body.append(PVarTable(erows, bgcolor='MistyRose2'))
        etitle = Anchor('Families',
                        href='edit.families.%s' % self.profile.current.profile)
        self.body.append(SectionTitle(etitle))
        families = self.profile.get_families()
        flist = UnorderedList()
        for f in families:
            flist.append(ListItem(f))
        self.body.append(flist)
Esempio n. 16
0
 def refresh_page(self):
     self.clear_body()
     title = SectionTitle('Kernels')
     self.body.append(title)
     kernels = self.kernels.get_kernels()
     table = Table()
     self.body.append(table)
     for kernel in kernels:
         tablerow = TableRow()
         cell = TableCell(kernel)
         tablerow.append(cell)
         del_anchor = Anchor('(delete)', href='delete||kernel||%s' % kernel)
         cell = TableCell(del_anchor)
         tablerow.append(cell)
         table.append(tablerow)
Esempio n. 17
0
 def set_disk(self, diskname):
     clause = Eq('diskname', diskname)
     self.clear_body()
     title = SectionTitle('Disk:  %s' % diskname)
     attributes = dict(bgcolor='IndianRed', width='100%')
     title.attributes.update(attributes)
     self.body.append(title)
     self.body.append(Header('Partitions', level=2))
     rows = self.cursor.select(table='partitions',
                               clause=clause,
                               order='partition')
     fields = ['partition', 'start', 'size', 'Id']
     ptable = self._make_table(fields, rows, bgcolor='DarkSeaGreen')
     self.body.append(ptable)
     self._make_footer_anchors('disk', diskname)
Esempio n. 18
0
 def set_mount(self, mount):
     clause = Eq('mnt_name', mount)
     self.clear_body()
     title = SectionTitle('Mount:  %s' % mount)
     attributes = dict(bgcolor='IndianRed', width='100%')
     title.attributes.update(attributes)
     self.body.append(title)
     self.body.append(Header('Mounts', level=2))
     rows = self.cursor.select(table='mounts', clause=clause)
     fields = [
         'mnt_name', 'mnt_point', 'fstype', 'mnt_opts', 'dump', 'pass'
     ]
     mtable = self._make_table(fields, rows, bgcolor='DarkSeaGreen')
     self.body.append(mtable)
     self._make_footer_anchors('mount', mount)
Esempio n. 19
0
 def set_diskconfig(self, diskconfig):
     row = self.diskconfig.get(diskconfig)
     self.clear_body()
     title = SectionTitle('DiskConfig: %s' % row.name)
     self.body.append(title)
     content = row.content
     if content is None:
         content = ''
     pre = Pre(content)
     self.body.append(pre)
     self.body.append(Ruler())
     editanchor = Anchor('edit', href='edit.diskconfig.%s' % row.name)
     self.body.append(editanchor)
     self.body.append(Ruler())
     deleteanchor = Anchor('delete', href='delete.diskconfig.%s' % row.name)
     self.body.append(deleteanchor)
Esempio n. 20
0
 def set_machine(self, machine):
     self.machine.set_machine(machine)
     self.clear_body()
     title = SectionTitle('Machine:  %s' % machine)
     title['bgcolor'] = 'IndianRed'
     title['width'] = '100%'
     self.body.append(title)
     mtable = Table()
     for k, v in self.machine.current.items():
         tablerow = TableRow()
         tablerow.append(TableCell(Bold(k)))
         tablerow.append(TableCell(v))
         mtable.append(tablerow)
     self.body.append(mtable)
     newanchor = Anchor('new', href='new.machine.foo')
     editanchor = Anchor('edit', href='edit.machine.%s' % machine)
     self.body.append(Ruler())
     self.body.append(editanchor)
     self.body.append(Break())
     self.body.append(newanchor)
Esempio n. 21
0
    def set_filesystem(self, filesystem):
        clause = Eq('filesystem', filesystem)
        self.clear_body()
        title = SectionTitle('Filesystem:  %s' % filesystem)
        attributes = dict(bgcolor='IndianRed', width='100%')
        title.attributes.update(attributes)
        self.body.append(title)
        self.body.append(Header('Filesystem Mounts', level=2))

        rows = self.cursor.select(table='filesystem_mounts',
                                  clause=clause,
                                  order=['ord'])
        fields = ['mnt_name', 'partition', 'ord', 'size']
        mounttable = self._make_table(fields, rows, bgcolor='DarkSeaGreen')
        self.body.append(mounttable)
        self.body.append(Ruler())
        self.body.append(Header('Fstab for %s' % filesystem, level=2))
        fstab = self.mtype.make_fstab(filesystem)
        self.body.append(Pre(fstab))
        self._make_footer_anchors('filesystem', filesystem)