コード例 #1
0
ファイル: umlrun.py プロジェクト: BackupTheBerlios/paella-svn
def install(machine):
    cfg = Configuration("umlchroot")
    conn = InstallerConnection(cfg)
    ui = UmlInstaller(conn, cfg)
    umcfg = Configuration(files=Configuration("umlmachines")["uml_machines_conf"])
    umcfg.change(machine)
    u = UmlRunner(umcfg)
    basefile = join(umcfg["base_path"], umcfg["basefile"])
    ui.install_profile(umcfg["profile"], basefile)
    u.set(machine)
    return u
コード例 #2
0
 def __init__(self, conn, name='ClientManager'):
     CommandBoxWindow.__init__(self)
     self.set_title('Client Manager')
     self.conn = conn
     self.cfg = PaellaConfig()
     client_cmds = ['import', 'export', 'remove']
     self.add_menu(client_cmds, 'client', self.menu_command)
     self.client_view = ScrollCList()
     self.vbox.add(self.client_view)
     self.client_path = self.cfg.get('management_gui', 'client_path')
     self.client_cfg = Configuration(
         files=[os.path.join(self.client_path, 'config')])
     self.clients = self.client_cfg.sections()
     self.client_view.set_rows(self.clients, ['client'])
     self.dialogs = {}.fromkeys(client_cmds)
コード例 #3
0
ファイル: lprd.py プロジェクト: pombredanne/paella-svn
def make_base_filesystem(suite, name, cfg=None, size=3000, mkfs='mke2fs'):
    if cfg is None:
        cfg = Configuration('pbootstrap')
    path = join(cfg['basetarball_path'], name)
    makepaths(dirname(path))
    create_root_filesystem(path, 3000)
    uml = UmlBootstrapper(suite, path)
    uml.run_uml()
コード例 #4
0
ファイル: lprd.py プロジェクト: pombredanne/paella-svn
 def __init__(self, suite, rootimage=None, cfg=None):
     if rootimage is None:
         rootimage = suite + '.base'
     if cfg is None:
         cfg = Configuration('pbootstrap')
     UmlChroot.__init__(self, cfg)
     self.set_rootimage(rootimage)
     o = self.options
     o['paellasuite'] = suite
     o['basetarball'] = self.cfg['basetarball_path']
コード例 #5
0
 def __init__(self, conn, name='ClientManager'):
     CommandBoxWindow.__init__(self)
     self.set_title('Client Manager')
     self.conn = conn
     self.cfg = PaellaConfig()
     client_cmds = ['import', 'export', 'remove']
     self.add_menu(client_cmds, 'client', self.menu_command)
     self.client_view = ScrollCList()
     self.vbox.add(self.client_view)
     self.client_path = self.cfg.get('management_gui', 'client_path')
     self.client_cfg = Configuration(files=[os.path.join(self.client_path, 'config')])
     self.clients = self.client_cfg.sections()
     self.client_view.set_rows(self.clients, ['client'])
     self.dialogs = {}.fromkeys(client_cmds)
コード例 #6
0
ファイル: lprd.py プロジェクト: pombredanne/paella-svn
 def __init__(self, cfg=None):
     _Uml.__init__(self)
     self.devfs()
     self.console()
     if cfg is None:
         cfg = Configuration('umlchroot')
     self.cfg = cfg
     o = self.options
     o['root'] = '/dev/root'
     o['rootflags'] = '/'
     o['rootfstype'] = 'hostfs'
     o['init'] = self.cfg['initscript']
     o['eth0'] = self.cfg['eth0']
     o['python_path'] = self.cfg['python_path']
     o['paellarc'] = self.cfg['paellarc']
コード例 #7
0
 def __init__(self, *args):
     SimpleXMLRPCServer.__init__(self, *args)
     self.suites = ['sid', 'sarge', 'woody', 'woody/non-US']
     self.cfg = Configuration('repos')
     self.repos = dict([(suite, LocalRepos(self._srcline_(suite)))
                        for suite in self.suites])
     self._fully_parsed = {}
     for suite, repos in self.repos.items():
         repos.parse_release()
         repos.parse()
         for section in repos.source.sections:
             if suite == 'woody/non-US':
                 suite = 'woody'
             key = ujoin(suite, section)
             self._fully_parsed[key] = repos.full_parse(section)
コード例 #8
0
ファイル: umlrun.py プロジェクト: pombredanne/paella-svn
def install(machine):
    cfg = Configuration('umlchroot')
    conn = InstallerConnection(cfg)
    ui = UmlInstaller(conn, cfg)
    umcfg = Configuration(
        files=Configuration('umlmachines')['uml_machines_conf'])
    umcfg.change(machine)
    u = UmlRunner(umcfg)
    basefile = join(umcfg['base_path'], umcfg['basefile'])
    ui.install_profile(umcfg['profile'], basefile)
    u.set(machine)
    return u
コード例 #9
0
ファイル: confgen.py プロジェクト: pombredanne/paella-svn
 def __init__(self, conn, suite, trait, tmp_path, name='ConfigGen'):
     MenuWindow.__init__(self)
     self.__original_text__ = ''
     self.editor = TemplateEnvironment(conn)
     self.editor.set_suite(suite)
     self.editor.set_trait(trait)
     self.vbox.add(self.editor)
     self.conn = conn
     self.__add_menus__()
     self.filename = ''
     self.filesel = None
     self.set_size_request(600, 500)
     self.cfg = Configuration()
     self.cfg.section = 'paella-admin'
     self.conf_path = self.cfg['config_path']
     self.template_path = pjoin(self.cfg['template_path'], suite, trait)
     self.tmp_path = tmp_path
     makepaths(self.template_path)
     self.dialogs = {}.fromkeys(['template_record', 'environment'])
コード例 #10
0
class ClientManager(CommandBoxWindow):
    def __init__(self, conn, name='ClientManager'):
        CommandBoxWindow.__init__(self)
        self.set_title('Client Manager')
        self.conn = conn
        self.cfg = PaellaConfig()
        client_cmds = ['import', 'export', 'remove']
        self.add_menu(client_cmds, 'client', self.menu_command)
        self.client_view = ScrollCList()
        self.vbox.add(self.client_view)
        self.client_path = self.cfg.get('management_gui', 'client_path')
        self.client_cfg = Configuration(
            files=[os.path.join(self.client_path, 'config')])
        self.clients = self.client_cfg.sections()
        self.client_view.set_rows(self.clients, ['client'])
        self.dialogs = {}.fromkeys(client_cmds)

    def menu_command(self, menuitem, name):
        client = self.client_view.get_selected_data()[0][0]
        if name == 'export':
            self.export_client(client)
        elif name == 'import':
            self.import_client(client)
        elif name == 'remove':
            self.remove_client(client)
        else:
            dialogs.Message('%s %s' % (name, client))

    def _cpaths_(self, client):
        cpath = os.path.join(self.client_path, client)
        ppath = os.path.join(cpath, 'profiles')
        fpath = os.path.join(cpath, 'families')
        tpath = os.path.join(cpath, 'traits')
        return [cpath, ppath, fpath, tpath]

    def _client_schema(self, client):
        profiles = self.client_cfg.get_list('profiles', client)
        families = self.client_cfg.get_list('families', client)
        traits = self.client_cfg.get_list('traits', client)
        return [profiles, families, traits]

    def _client_mdata(self, client):
        disks = self.client_cfg.get_list('disks', client)
        mtypes = self.client_cfg.get_list('machine_types', client)
        machines = self.client_cfg.get_list('machines', client)
        return [disks, mtypes, machines]

    def export_client(self, client):
        cpath, ppath, fpath, tpath = self._cpaths_(client)
        makepaths(cpath)
        profiles, families, traits = self._client_schema(client)
        disks, mtypes, machines = self._client_mdata(client)
        if not disks:
            disks = None
        if not mtypes:
            mtypes = None
        if not machines:
            machines = None
        element = ClientMachineDatabaseElement(self.conn, disks, mtypes,
                                               machines)
        mdbpath = join(cpath, 'machine_database.xml')
        mdfile = file(mdbpath, 'w')
        mdfile.write(element.toprettyxml())
        mdfile.close()
        if profiles:
            makepaths(ppath)
            pp = PaellaProfiles(self.conn)
            for profile in profiles:
                pp.write_profile(profile, ppath)
        if families:
            makepaths(fpath)
            f = Family(self.conn)
            for family in families:
                f.write_family(family, fpath)
        if traits:
            makepaths(tpath)

    def import_client(self, client):
        cpath, ppath, fpath, tpath = self._cpaths_(client)
        profiles, families, traits = self._client_schema(client)
        mdbpath = join(cpath, 'machine_database.xml')
        if families:
            f = Family(self.conn)
            f.import_families(fpath)
        if profiles:
            pp = PaellaProcessor(self.conn)
            pp.main_path = cpath
            pp.insert_profiles()
        mh = MachineHandler(self.conn)
        md = mh.parse_xmlfile(mdbpath)
        mh.insert_parsed_element(md)

    def remove_client(self, client):
        profiles, families, traits = self._client_schema(client)
        disks, mtypes, machines = self._client_mdata(client)
        cursor = StatementCursor(self.conn)
        if machines:
            cursor.delete(table='machines', clause=In('machine', machines))
        for mtype in mtypes:
            cursor.execute("select * from delete_mtype('%s')" % mtype)
        for disk in disks:
            cursor.execute("select * from delete_disk('%s')" % disk)
        for profile in profiles:
            cursor.execute("select * from delete_profile('%s')" % profile)
        for family in families:
            cursor.execute("select * from delete_family('%s')" % family)
コード例 #11
0
                rrepos.add_source(suite, source)
                source.uri = remote_uri
                rrepos.add_source(suite, source)
                source.uri = local_uri
                rrepos.set_source(suite, type)
                rrepos.update_release()
                rrepos.update_sections()







if __name__ == '__main__':
    cfg = Configuration()
    #conn = LocalConnection(cfg['repos_db'])
    from paella.db.lowlevel import QuickConn
    #conn = QuickConn(cfg)
    conn = RepositoryConnection()
    mirror = 'http://10.0.0.2/debian'
    path = '/mirrors/share/Debian/repos/'

    sources = parse_sources_list('/etc/apt/sources.list')

    ls = sources[0]
    rs = sources[2]

    #rp = LocalRepos(ls)
    r = Repository(conn)
    rr = RemoteRepository(conn)
コード例 #12
0
ファイル: admin.py プロジェクト: pombredanne/paella-svn
            tsv.write('\t'.join(line) + '\n')
            row = self.cursor.fetchone()
        tsv.close()

    def set_table(self, table):
        self.stmt.set_table(table)

    def insert(self, table):
        self.cursor.set_table(table)
        tsv = Parser(join(self.path, table + '.tsv'))
        for row in tsv:
            self.cursor.insert(data=row)

    def copyto(self, table):
        path = join(self.path, table + '.bkup')
        self.cursor.copyto(table, path)

    def copyfrom(self, table):
        path = join(self.path, table + '.bkup')
        self.cursor.copyfrom(table, path)

    def backup(self):
        map(self.copyto, self.cursor.tables())


if __name__ == '__main__':
    g = Configuration(files=['/etc/paellarc'])
    ac = AdminConnection(g, 'paella')
    #ac.set_path('/home/umeboshi/workspace/dbackup')
    table = 'current_environment'
コード例 #13
0
ファイル: build.py プロジェクト: pombredanne/paella-svn
import os, sys
from os.path import join, isfile, isdir
from time import sleep
import commands

from paella.base import Error
from paella.base.config import Configuration

config = Configuration(files='./kernels.conf')
here = os.getcwd()


def get_all_kernels():
    return config.get_list('allkernels', 'DEFAULT')


def get_version(dir=here):
    changelog = join(dir, 'debian/changelog')
    pipeline = "head -n1 %s | gawk '{print $2}' " % changelog
    pipeline += " | cut -f2 -d\( | cut -f1 -d\)"
    command = 'bash -c "%s"' % pipeline
    return commands.getoutput(command)


def commalist(a_list):
    return ','.join(a_list)


def kernel_name(flavor):
    config.change(flavor)
    kver = config['kver']
コード例 #14
0
ファイル: base.py プロジェクト: BackupTheBerlios/paella-svn
 def __init__(self, section='umlmachines',
              files=list_rcfiles('umlmachines.conf')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)
コード例 #15
0
    umcfg = get_machines_config(machine)
    u = UmlRunner(umcfg)
    u.set(machine)
    u.run(oldway=False)
    u.command('apt-get -y update')
    u.command('apt-get build-depends %s' % package)
    u.command('apt-get source %s' % package)
    u.uml.shutdown()


def extract(tarball, basefile=None, size=None):
    cfg = UmlConfig()
    u = UmlChroot(cfg)
    u.options['paella_system_tarball'] = tarball
    u.options['paella_action'] = 'extract'
    u.options['devfs'] = 'mount'
    u.set_targetimage(basefile)
    if size is None:
        size = cfg['basefile_size']
    create_sparse_file(basefile, size=size)
    u.run_uml()


if __name__ == '__main__':
    umcfg = Configuration(
        files=Configuration('umlmachines')['uml_machines_conf'])
    u = UmlRunner(umcfg)
    import sys
    if len(sys.argv) > 1:
        run(sys.argv[1])
コード例 #16
0
ファイル: themer.py プロジェクト: pombredanne/paella-svn
from gtk import mainloop, mainquit

from paella.db.lowlevel import QuickConn
from paella.db.midlevel import StatementCursor
from paella.sqlgen.defaults import NameTable
from paella.sqlgen.write import insert, update

from gtk import DEST_DEFAULT_MOTION
from gtk import DEST_DEFAULT_HIGHLIGHT
from gtk import DEST_DEFAULT_DROP
from gtk.gdk import ACTION_COPY, ACTION_MOVE
from gtk.gdk import BUTTON1_MASK
from gtk import STATE_NORMAL, STATE_PRELIGHT
from gtk.gdk import Color as GdkColor

config = Configuration()
template_path = os.path.expanduser(config['template_path'])
template_path = os.path.join(template_path, 'themes')
style_elements = ['fg', 'bg', 'base', 'text']
element_states = ['ACTIVE', 'INSENSITIVE', 'NORMAL', 'PRELIGHT', 'SELECTED']

gtk1rcpath = 'gtk/gtkrc'
gtk2rcpath = 'gtk-2.0/gtkrc'

theme_base = 'ice-base'

color_target = ('color', 0, 22)


def _bg_widget(widget, color):
    widget.modify_bg(STATE_NORMAL,
コード例 #17
0
class ClientManager(CommandBoxWindow):
    def __init__(self, conn, name='ClientManager'):
        CommandBoxWindow.__init__(self)
        self.set_title('Client Manager')
        self.conn = conn
        self.cfg = PaellaConfig()
        client_cmds = ['import', 'export', 'remove']
        self.add_menu(client_cmds, 'client', self.menu_command)
        self.client_view = ScrollCList()
        self.vbox.add(self.client_view)
        self.client_path = self.cfg.get('management_gui', 'client_path')
        self.client_cfg = Configuration(files=[os.path.join(self.client_path, 'config')])
        self.clients = self.client_cfg.sections()
        self.client_view.set_rows(self.clients, ['client'])
        self.dialogs = {}.fromkeys(client_cmds)
        
    def menu_command(self, menuitem, name):
        client = self.client_view.get_selected_data()[0][0]
        if name == 'export':
            self.export_client(client)
        elif name == 'import':
            self.import_client(client)
        elif name == 'remove':
            self.remove_client(client)
        else:
            dialogs.Message('%s %s' % (name, client))
            
    def _cpaths_(self, client):
        cpath = os.path.join(self.client_path, client)
        ppath = os.path.join(cpath, 'profiles')
        fpath = os.path.join(cpath, 'families')
        tpath = os.path.join(cpath, 'traits')
        return [cpath, ppath, fpath, tpath]

    def _client_schema(self, client):
        profiles = self.client_cfg.get_list('profiles', client)
        families = self.client_cfg.get_list('families', client)
        traits = self.client_cfg.get_list('traits', client)
        return [profiles, families, traits]
    
    def _client_mdata(self, client):
        disks = self.client_cfg.get_list('disks', client)
        mtypes = self.client_cfg.get_list('machine_types', client)
        machines = self.client_cfg.get_list('machines', client)
        return [disks, mtypes, machines]
    
    def export_client(self, client):
        cpath, ppath, fpath, tpath = self._cpaths_(client)
        makepaths(cpath)
        profiles, families, traits = self._client_schema(client) 
        disks, mtypes, machines = self._client_mdata(client)
        if not disks:
            disks = None
        if not mtypes:
            mtypes = None
        if not machines:
            machines = None
        element = ClientMachineDatabaseElement(self.conn, disks, mtypes, machines)
        mdbpath = join(cpath, 'machine_database.xml')
        mdfile = file(mdbpath, 'w')
        mdfile.write(element.toprettyxml())
        mdfile.close()
        if profiles:
            makepaths(ppath)
            pp = PaellaProfiles(self.conn)
            for profile in profiles:
                pp.write_profile(profile, ppath)
        if families:
            makepaths(fpath)
            f = Family(self.conn)
            for family in families:
                f.write_family(family, fpath)
        if traits:
            makepaths(tpath)

    def import_client(self, client):
        cpath, ppath, fpath, tpath = self._cpaths_(client)
        profiles, families, traits = self._client_schema(client)
        mdbpath = join(cpath, 'machine_database.xml')
        if families:
            f = Family(self.conn)
            f.import_families(fpath)
        if profiles:
            pp = PaellaProcessor(self.conn)
            pp.main_path = cpath
            pp.insert_profiles()
        mh = MachineHandler(self.conn)
        md = mh.parse_xmlfile(mdbpath)
        mh.insert_parsed_element(md)    
        
            
    def remove_client(self, client):
        profiles, families, traits = self._client_schema(client)
        disks, mtypes, machines = self._client_mdata(client)
        cursor = StatementCursor(self.conn)
        if machines:
            cursor.delete(table='machines', clause=In('machine', machines))
        for mtype in mtypes:
            cursor.execute("select * from delete_mtype('%s')" % mtype)
        for disk in disks:
            cursor.execute("select * from delete_disk('%s')" % disk)
        for profile in profiles:
            cursor.execute("select * from delete_profile('%s')" % profile)
        for family in families:
            cursor.execute("select * from delete_family('%s')" % family)
コード例 #18
0
ファイル: lprd.py プロジェクト: pombredanne/paella-svn
        cfg = Configuration('pbootstrap')
    path = join(cfg['basetarball_path'], name)
    makepaths(dirname(path))
    create_root_filesystem(path, 3000)
    uml = UmlBootstrapper(suite, path)
    uml.run_uml()


def make_bases():
    for s in ['woody', 'sarge', 'sid']:
        make_base_filesystem(s, s + '.base')


class UmlLeopard(UmlBootstrapper):
    def __init__(self, rootimage=None, cfg=None):
        if rootimage is None:
            rootimage = 'leopard_root'
        UmlBootstrapper.__init__(self, 'leopard', rootimage, cfg)


if __name__ == '__main__':
    u = UmlBootstrapper('sid')
    crf = create_root_filesystem
    cfg = Configuration('umlleopard')
    basepath = cfg['basetarball_path']
    conn = InstallerConnection(cfg)
    u = UmlInstaller(conn, cfg)
    path = cfg['rootimage_path']
    ul = UmlLeopard('tmp/leopard', cfg)
    ul.options['root_tarball'] = join(os.getcwd(), 'leopard.tar')
コード例 #19
0
ファイル: base.py プロジェクト: pombredanne/paella-svn
 def __init__(self,
              section='umlmachines',
              files=list_rcfiles('umlmachines.conf')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)
コード例 #20
0
 def __init__(self, cfg=Configuration('repos')):
     QuickConn.__init__(self, cfg)
コード例 #21
0
ファイル: base.py プロジェクト: BackupTheBerlios/paella-svn
 def __init__(self, section=None, files=list_rcfiles('paellarc')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)
コード例 #22
0
ファイル: base.py プロジェクト: pombredanne/paella-svn
 def __init__(self, section=None, files=list_rcfiles('paellarc')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)