def perform_full_import(self, dirname): self.set_main_path(dirname) dbdata = self.parse_main_xml() self.start_schema() self.import_apt_sources(dbdata.aptsources) self.report_total_suites(len(dbdata.suites)) for suite in dbdata.suites: self.make_suite(suite) suitedir = self.main_path / suite.name self._import_traits(suite.name, dbdata.get_traits(suite.name), suitedir) self.report_suite_imported(suite.name) self.import_all_families() self.import_all_profiles() self.import_all_diskconfigs() machinedb = self.main_path / 'machine_database.xml' if machinedb.isfile(): mh = MachineHandler(self.conn) mh.import_machine_database(self.main_path) default_environment_basename = 'default-environment' filename = self.main_path / default_environment_basename if filename.isfile(): # similar code exists in kde/environ.py defenv = DefaultEnvironment(self.conn) newcfg = RawConfigParser() newcfg.read(filename) defenv.update(newcfg) self.import_all_aptkeys()
def __init__(self): object.__init__(self) self.cfg = PaellaConfig() self.conn = InstallerConnection() self.profile = os.environ['PAELLA_PROFILE'] self.target = os.environ['PAELLA_TARGET'] self.machine = None self.trait = None self.suite = get_suite(self.conn, self.profile) self.pr = Profile(self.conn) self.pr.set_profile(self.profile) self.traitlist = self.pr.make_traitlist() self.pe = ProfileEnvironment(self.conn, self.profile) self.tp = TraitParent(self.conn, self.suite) self.fm = Family(self.conn) self.tr = Trait(self.conn, self.suite) self.families = list( self.fm.get_related_families(self.pr.get_families())) self._envv = None self.default = DefaultEnvironment(self.conn) #self.installer = TraitInstaller(self.conn, self.suite) self.installer = ProfileInstaller(self.conn) self.installer.set_logfile() self.installer.set_profile(self.profile) self.installer.set_target(self.target) if os.environ.has_key('PAELLA_MACHINE'): self.machine = os.environ['PAELLA_MACHINE'] if os.environ.has_key('PAELLA_TRAIT'): self.set_trait(os.environ['PAELLA_TRAIT'])
def __init__(self): object.__init__(self) self.cfg = PaellaConfig() self.conn = InstallerConnection() self.profile = os.environ['PAELLA_PROFILE'] self.target = path(os.environ['PAELLA_TARGET']) self.machine = None self.trait = None self.suite = get_suite(self.conn, self.profile) self.db = ToolkitDatabase(self.conn) self.db.set_profile(self.profile) self.traits = self.db.profile.make_traitlist() profile_families = self.db.profile.get_families() self.families = list( self.db.family.get_related_families(profile_families)) self.default = DefaultEnvironment(self.conn) if os.environ.has_key('PAELLA_MACHINE'): self.machine = os.environ['PAELLA_MACHINE'] self.db.set_machine(self.machine) # we need to make an installer to do # some of the installer functions. self.installer = None if os.environ.has_key('PAELLA_TRAIT'): self.set_trait(os.environ['PAELLA_TRAIT'])
def __init__(self, conn): object.__init__(self) self.conn = conn self.target = None self.defenv = DefaultEnvironment(self.conn) #check for default environment rows = self.defenv.cursor.select() if not len(rows): raise InstallSetupError, 'There is no data in the default_environment table'
def __init__(self, conn): CommandBoxWindow.__init__(self) self.conn = conn self.defenv = DefaultEnvironment(self.conn) self.add_menu(['load', 'edit', 'save'], 'main', self.main_menu_selected) self.cursor = StatementCursor(self.conn) self.cursor.set_table('default_environment') self.view = ScrollCList() self.vbox.add(self.view) self.reset_rows()
def __init__(self, conn, cfg=None): object.__init__(self) self.conn = conn self.target = None self.cfg = cfg self.defenv = DefaultEnvironment(self.conn) #check for default environment rows = self.defenv.cursor.select() if not len(rows): raise Error, 'There is no data in the default_environment table' self.set_logfile('_unused_')
def __init__(self, conn): BaseProcessor.__init__(self) self.conn = conn self.target = None self.suite = None self.base_suite = None self.defenv = DefaultEnvironment(self.conn) # an attribute for the child installer self.installer = None # check for default environment rows = self.defenv.cursor.select() if not len(rows): raise DefaultEnvironmentError, 'There is no data in the default_environment table'
def __init__(self, conn, cfg): object.__init__(self) self.conn = conn self.cfg = cfg self.defenv = DefaultEnvironment(self.conn) self.machine = MachineHandler(self.conn) self.cursor = StatementCursor(self.conn) self.target = None self.installer = None self._mounted = None self._bootstrapped = None self.debmirror = self.cfg.get('debrepos', 'http_mirror') self._raid_setup = False self._raid_drives = {} self._enable_bad_hacks = False if self.cfg.is_it_true('installer', 'enable_bad_hacks'): self._enable_bad_hacks = True
def __init__(self): object.__init__(self) self.cfg = PaellaConfig() self.conn = InstallerConnection() self.profile = os.environ['PAELLA_PROFILE'] self.target = path(os.environ['PAELLA_TARGET']) self.machine = None self.trait = None self.suite = get_suite(self.conn, self.profile) # we add this here as a convenience # we need to think about using check_call # instead of call for subprocess (just found # out about it) self.CmdLineError = CmdLineError # another convenience for using # pipes in subprocess calls self.PIPE = subprocess.PIPE self.db = ToolkitDatabase(self.conn) self.db.set_profile(self.profile) self.traits = self.db.profile.make_traitlist() # we need better family attributes # for both profile families and machine families profile_families = self.db.profile.get_families() self.profile_families = list( self.db.family.get_related_families(profile_families)) self.default = DefaultEnvironment(self.conn) # we should really use __getattr__ to raise a # warning when the families attribute is being # accessed so that we can be notified when there # are scripts that use it. self.families = self.profile_families if os.environ.has_key('PAELLA_MACHINE'): self.machine = os.environ['PAELLA_MACHINE'] self.db.set_machine(self.machine) # we need to make an installer to do # some of the installer functions. self.installer = None if os.environ.has_key('PAELLA_TRAIT'): self.set_trait(os.environ['PAELLA_TRAIT'])
def make_sources_list_common(conn, target, suite, installer=False): defenv = DefaultEnvironment(conn) suitecursor = SuiteCursor(conn) apt_rows = suitecursor.get_apt_rows(suite) if installer: # while installing use sources from local mirror uri = defenv.get('installer', 'http_mirror') else: # otherwise use official sources list uri = None apt_lines = make_sources_list_lines(apt_rows, uri=uri, installer=installer) aptdir = os.path.join(target, 'etc', 'apt') makepaths(aptdir) sources_list = file(os.path.join(aptdir, 'sources.list'), 'w') for line in apt_lines: sources_list.write('%s\n' % line) sources_list.write('\n') sources_list.close()
from useless.base.path import path from paella.base import PaellaConfig from paella.db import PaellaConnection from paella.db.trait import Trait from paella.db.family import Family from paella.db.profile import Profile from paella.db.machine import MachineHandler from paella.db.installer import InstallerManager from paella.db import DefaultEnvironment from paella.installer.toolkit import InstallerTools if __name__ == '__main__': cfg = PaellaConfig() conn = PaellaConnection() suite = 'bootstrap' t = Trait(conn, suite) f = Family(conn) p = Profile(conn) m = MachineHandler(conn) de = DefaultEnvironment(conn) im = InstallerManager(conn) #os.environ['PAELLA_MACHINE'] = 'testmachine' os.environ['PAELLA_PROFILE'] = 'default' os.environ['PAELLA_TARGET'] = path('/foo/bar') it = InstallerTools()
def __init__(self, conn): self.conn = conn self.defenv = DefaultEnvironment(conn)
def _update_dfenv(self, newcfg): self.defenv.update(newcfg) self.defenv = DefaultEnvironment(self.conn) self.reset_rows()