def _run_upgrade(self): self._logger.info("hooks: %s" % self._options.skip_existing_hooks) self._python_lib = glob.glob("%s/rootfs/usr/lib/python*" % self._tmp_dir) if not self._python_lib: raise RuntimeError("Unable to determine python path") self._python_lib = self._python_lib[0] sys.path.append(self._python_lib + "/site-packages/") self._tmp_python_path = "%s/site-packages/ovirtnode" \ % self._python_lib shutil.copytree(self._tmp_python_path, self._ovirtnode_dir) # import install and ovirtfunctions modules from new image f, filename, description = imp.find_module( 'install', [self._ovirtnode_dir], ) install = imp.load_module( 'install', f, filename, description, ) f, filename, description = imp.find_module( 'ovirtfunctions', [self._ovirtnode_dir], ) ovirtfunctions = imp.load_module( 'ovirtfunctions', f, filename, description, ) # log module detail for debugging self._logger.debug(install) import install import ovirtfunctions as _functions_new install._functions = _functions_new upgrade = install.Install() self._logger.propagate = True self._logger.info("Installing Bootloader") if not upgrade.ovirt_boot_setup(): raise RuntimeError("Bootloader Installation Failed") sys.path.append(self._python_lib + "/site-packages/") from ovirt.node.config import migrate migrate.MigrateConfigs().translate_all()
def __init__(self, update='all'): tables = { 'credit': credit.Credit() if update == 'all' or ('credit' in update) else credit.Credit.from_cache(), 'bureau': bureau.Bureau() if update == 'all' or ('bureau' in update) else bureau.Bureau.from_cache(), 'prev': prev.Prev() if update == 'all' or ('prev' in update) else prev.Prev.from_cache(), 'install': install.Install() if update == 'all' or ('install' in update) else install.Install.from_cache(), 'cash': pos_cash.PosCash() if update == 'all' or ('cash' in update) else pos_cash.PosCash.from_cache(), 'app': application.Application() if update == 'all' or ('app' in update) else application.Application.from_cache() } print('transform...') for k, v in tables.items(): print(k) v.fill() v.transform() df = tables['app'].df for k, v in tables.items(): if k == 'app': continue df = v.aggregate(df) print('{} merged. shape: {}'.format(k, df.shape)) df = tables['app'].transform_with_others(df, tables['prev'].df, tables['cash'].df, tables['credit'].df) print('transform finished. {}'.format(df.shape)) self.tables = tables self.df = df self._load_exotic() self._delete_columns()
def main(): if len(sys.argv) > 1 and sys.argv[1] == 'ftp': args = sys.argv[:] args.remove('ftp') import ftpd ftpd.ftpmain(args) sys.exit(0) parser = OptionParser(version='%%prog %s' % __version__) parser.set_usage( '%prog [options] command [job..]\n\n' '\tcommand in "backup", "check", "checkmail"\n\n' '\tuse "ftp" in first place to start buil-in ftp server,\n' '\tuse "ftp -h" in this order for more') parser.add_option("-c", "--config", dest="config", default='mksbackup.ini', help="use another ini file", metavar="configfile") parser.add_option("-d", "--debug", dest="debug", action="store_true", default=False, help="switch to debug level, increase verbosity") parser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=True, help="write logging to the terminal (default)") parser.add_option("-q", "--quiet", dest="verbose", action="store_false", default=True, help="don't write logging to the terminal") parser.add_option("-l", "--logfile", dest="logfile", default='mksbackup.log', help="log to this file", metavar="logfile") parser.add_option( "-s", "--statusdir", dest="statusdir", default=None, help="the directory where to write status of this backup", metavar="statusdir") parser.add_option("-e", "--encoding", dest="encoding", default='auto', help="configuration file encoding", metavar="encoding") parser.add_option("-i", "--install", dest="install", action="store_true", help="install and pre-setup a task in scheduler") cmd_options, cmd_args = parser.parse_args(sys.argv) if cmd_options.install or len(sys.argv) == 1: import install try: res = install.Install() except Exception, e: print 'Unexpected Error: %s' % (e, ) raise sys.exit(res)
def upgrade_pkg_names(A=[]): """Re-installs packages from the repository, trying to perform a minimum or maximum number of upgrades according to options.""" ignore_build = ctx.get_option('ignore_build_no') security = ctx.get_option('security') if not A: # if A is empty, then upgrade all packages A = ctx.installdb.list_installed() A_0 = A = component.expand_components(set(A)) Ap = [] for x in A: if x.endswith(ctx.const.package_suffix): ctx.ui.debug(_("Warning: package *name* ends with '.pisi'")) if not ctx.installdb.is_installed(x): ctx.ui.info(_('Package %s is not installed.') % x, True) continue (version, release, build) = ctx.installdb.get_version(x) if ctx.packagedb.has_package(x): pkg = ctx.packagedb.get_package(x) else: ctx.ui.info( _('Package %s is not available in repositories.') % x, True) continue if security: # below is a readable functional code, don't overflow lines! updates = [ x for x in pkg.history if Version(x.release) > Version(release) ] if not pisi.util.any(lambda x: x.type == 'security', updates): continue if ignore_build or (not build) or (not pkg.build): if Version(release) < Version(pkg.release): Ap.append(x) else: ctx.ui.info( _('Package %s is already at the latest release %s.') % (pkg.name, pkg.release), True) else: if build < pkg.build: Ap.append(x) else: ctx.ui.info( _('Package %s is already at the latest build %s.') % (pkg.name, pkg.build), True) A = set(Ap) if len(A) == 0: ctx.ui.info(_('No packages to upgrade.')) return True A |= upgrade_base(A) ctx.ui.debug('A = %s' % str(A)) if not ctx.config.get_option('ignore_dependency'): G_f, order = plan_upgrade(A, ignore_build) else: G_f = None order = A ctx.ui.info( _('The following packages will be upgraded: ') + util.strlist(order)) total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order]) total_size, symbol = util.human_readable_size(total_size) ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol)) if ctx.get_option('dry_run'): return if len(order) > len(A_0): if not ctx.ui.confirm( _('There are extra packages due to dependencies. Do you want to continue?' )): return False ctx.ui.notify(ui.packagestogo, order=order) paths = [] for x in order: install_op = install.Install.from_name(x) paths.append(install_op.package_fname) for path in paths: install_op = install.Install(path, ignore_file_conflicts=True) install_op.install(True) if 'pisi' in order: upgradepisi.upgrade_pisi()
def install(self): self.installpack = Toplevel(self) self.installpack.title("Install SambaPackages") self.inusr = install.Install(self.installpack)
import os import configFile import paths import currentDateTime import srcDownload.download import srcInstallation.installation import copyFile import configuration import regression import build import install install = install.Install() build = build.Build() regression = regression.Regression() configuration = configuration.Configuration() copyFile = copyFile.CopyFile() srcInstallation = srcInstallation.installation.Install() srcDownload = srcDownload.download.Download() currentDateTime = currentDateTime.savedDateTime configFile = configFile.ConfigFile() paths = paths.Path() os.environ['PYTHON_HOME'] = "/usr/bin" os.environ['LD_LIBRARY_PATH'] = "/usr/lib" os.environ['LDFLAGS'] = "-WL, -rpath," + os.environ['pwd'] + " -L/usr/lib" os.environ['CPPFLAGS'] = "-I/usr/include/python3.5m" os.environ['PYTHON'] = "/usr/bin/python3" # Setting up folder structure