def setup_initial_paellainfo_env(self, traits): if os.environ.has_key('PAELLA_MACHINE'): machine = os.environ['PAELLA_MACHINE'] curenv = CurrentEnvironment(self.conn, machine) curenv['current_profile'] = self.profile curenv['traitlist'] = ', '.join(traits) curenv['installed_traits'] = ''
def _append_installed_traits_db(self, trait): if os.environ.has_key('PAELLA_MACHINE'): machine = os.environ['PAELLA_MACHINE'] curenv = CurrentEnvironment(self.conn, machine) line = curenv['installed_traits'] traits = [t.strip() for t in line.split(',')] traits.append(trait) curenv['installed_traits'] = ', '.join(traits)
def make_filesystems(self): device = self.machine.array_hack(self.machine.current.machine_type) all_fsmounts = self.machine.get_installable_fsmounts() env = CurrentEnvironment(self.conn, self.machine.current.machine) for row in all_fsmounts: pdev = device + str(row.partition) if row.mnt_name in env.keys(): print '%s held' % row.mnt_name else: print 'making filesystem for', row.mnt_name make_filesystem(pdev, row.fstype)
def set_machine(self, machine): self.machine.set_machine(machine) try: logfile = os.environ['LOGFILE'] except KeyError: logfile = '/paellalog/paella-install-%s.log' % machine os.environ['LOGFILE'] = logfile os.environ['PAELLA_MACHINE'] = machine disklogpath = join(dirname(logfile), 'disklog') if not os.path.isdir(disklogpath): makepaths(disklogpath) self.disklogpath = disklogpath self.curenv = CurrentEnvironment(self.conn, self.machine.current.machine) self.set_logfile(logfile)
def set_machine(self, machine): self.machine.set_machine(machine) try: logfile = os.environ['LOGFILE'] except KeyError: logfile = '/paellalog/paella-install-%s.log' % machine os.environ['PAELLA_LOGFILE'] = logfile # this needs to be removed sometime os.environ['LOGFILE'] = logfile os.environ['PAELLA_MACHINE'] = machine disklogpath = join(dirname(logfile), 'disklog-%s' % machine) if not os.path.isdir(disklogpath): makepaths(disklogpath) self.disklogpath = disklogpath self.curenv = CurrentEnvironment(self.conn, self.machine.current.machine) self.set_logfile(logfile) self.log.info('Machine Installer set machine to %s' % machine) self.mtypedata = self.machine.mtype.get_machine_type_data()
def make_filesystems(self): device = self.machine.array_hack(self.machine.current.machine_type) mddev = False if device == '/dev/md': mdnum = 0 mddev = True all_fsmounts = self.machine.get_installable_fsmounts() env = CurrentEnvironment(self.conn, self.machine.current.machine) for row in all_fsmounts: if mddev: pdev = '/dev/md%d' % mdnum mdnum += 1 else: pdev = device + str(row.partition) if row.mnt_name in env.keys(): print '%s held' % row.mnt_name else: print 'making filesystem for', row.mnt_name make_filesystem(pdev, row.fstype)
def set_machine(self, machine): self.check_target_set() self.machine.set_machine(machine) logdir = path(self.defenv.get('installer', 'base_log_directory')) if not logdir.isdir(): logdir.mkdir() logfile = logdir / 'paella-install-%s.log' % machine os.environ['PAELLA_MACHINE'] = machine disklogpath = path(self.defenv.get('installer', 'disk_log_directory')) self.disklogpath = disklogpath / ('disklog-%s' % machine) if not self.disklogpath.isdir(): self.disklogpath.makedirs() self.set_logfile(logfile) self.log.info('machine set to %s' % machine) # we need to set machine_data before setting the profile # so that the machine_data is passed to the profile and trait installers self.machine_data = self.machine.get_machine_data() profile = self.machine.get_profile() self.set_profile(profile) self.curenv = CurrentEnvironment(self.conn, machine) self.helper = MachineInstallerHelper(self) self.helper.curenv = self.curenv
def set_machine(self, machine): self.machine.set_machine(machine) # this needs to be a configuration option # in the default environment logdir = path('/paellalog') if not logdir.isdir(): logdir.mkdir() logfile = logdir / 'paella-install-%s.log' % machine os.environ['PAELLA_MACHINE'] = machine self.disklogpath = logdir / ('disklog-%s' % machine) if not self.disklogpath.isdir(): self.disklogpath.mkdir() self.set_logfile(logfile) self.log.info('machine set to %s' % machine) # we need to set mtypedata before setting the profile # so that the mtypedata is passed to the profile and trait installers self.mtypedata = self.machine.mtype.get_machine_type_data() profile = self.machine.current.profile self.set_profile(profile) self.curenv = CurrentEnvironment(self.conn, machine) self.helper = MachineInstallerHelper(self) self.helper.curenv = self.curenv
def process(self): trait, packages, templates = self._info() self.log.info('processing trait: %s' % trait) if 'PAELLA_TARGET' not in os.environ.keys(): self.log.warn('PAELLA_TARGET not set.') os.environ['PAELLA_TARGET'] = self.target machine = None curenv = {} if 'PAELLA_MACHINE' in os.environ.keys(): machine = os.environ['PAELLA_MACHINE'] curenv = CurrentEnvironment(self.conn, machine) if machine is not None: self.log.info('processing trait %s on machine %s' % (trait, machine)) curenv['current_trait'] = trait for proc in self.trait_processes: self.log.info('processing %s for trait %s' % (proc, trait)) curenv['current_trait_process'] = proc if proc in self._process_map.keys(): self._process_map[proc]() else: self._process_generic_script(proc) self.log.info('%s has been processed for trait %s' % (proc, trait))
def make_filesystems(self): device = self.machine.mtype.array_hack() all_fsmounts = self.machine.get_installable_fsmounts() env = CurrentEnvironment(self.conn, self.machine.current.machine) make_filesystems(device, all_fsmounts, env)