def __init__(self, conn): self.conn = conn self.cfg = PaellaConfig() 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()
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 edit(self): tmp, path = tempfile.mkstemp('variables', 'config') tmp = file(path, 'w') self.write(tmp) tmp.close() os.system('$EDITOR %s' % path) tmp = file(path, 'r') newconfig = Configuration() newconfig.readfp(tmp) tmp.close() os.remove(path) backupfile = '%s~' % path if os.path.exists(backupfile): os.remove(backupfile) return newconfig
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'])
fltable = FilelistTable(self._table('files')) mk_filelist_table(self.cmd, fltable, config.get_files()) print 'making conffiles' cftable = FilelistTable(self._table('conffiles')) mk_filelist_table(self.cmd, cftable, config.get_conffiles()) print 'making md5sums' mdtable = Md5sumsTable(self._table('md5sums')) mk_md5sums_table(self.cmd, mdtable, config.get_md5sums()) print 'making current' cutable = Md5sumsTable(self._table('current')) mk_current_table(self.cmd, cutable, config.get_files()) if __name__ == '__main__': from useless.base.config import Configuration cfg = Configuration() Host = cfg['dbhost'] Dbname = 'sysconfig' User = cfg['dbusername'] Password = cfg['dbpassword'] dsn = dict(dbhost=cfg['dbhost'], dbname='sysconfig', dbusername=cfg['dbusername'], dbpassword=cfg['dbpassword']) c = QuickConn(dsn) cmd = CommandCursor(c, 'dsfsdf') #cmd.execute('create table %s' %t) co = ConfigObject() #co.set_every_config() #at = Table('atable', available_columns)
import os, sys from os.path import join, isfile, isdir from time import sleep import commands from useless.base import Error from useless.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']
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])
dict( zip(cols, [ 'base', 'light sea green', 'lavender', 'azure3', 'yellow', 'aquamarine' ]))) q4 = insert( 'themebase', dict( zip(cols, ['text', 'wheat', 'black', 'black', 'black', 'dark violet']))) map(cmd.execute, [q1, q2, q3, q4]) if __name__ == '__main__': from useless.base.config import Configuration dsn = Configuration().get_dsn() dsn['dbname'] = 'themes' c = QuickConn(dsn) win = ColorThingyWindow(cd, c) t = NameTable('themes', ['theme']) cmd = CommandCursor(c, 'dsfsdf') def dtable(): cmd.execute('drop table themebase') def dtables(): for t in cmd.tables(): if t not in ['footable']: cmd.execute('drop table %s' % t)