Ejemplo n.º 1
0
Archivo: boot.py Proyecto: 3lpsy/athena
    def run(self):
        self.log_start()
        data_to_load_path = Path(minerva_path('load'))
        database_path = Path(minerva_path('manager.sqlite'))

        if not database_path.is_file():
            logger().info("Creating database file for manager at {}".format(
                str(database_path)))
            database_path.touch()

        logger().debug("Attaching session engine for manager database")
        load_database_engine()
Ejemplo n.º 2
0
    def run(self):
        self.log_start()
        data_to_load_path = Path(minerva_path('load'))

        if not data_to_load_path.is_dir():
            raise DataToLoadDirNotFound(data_to_load_path)

        message = "Do you really want to destroy the loadable data in {}".format(
            str(data_to_load_path))
        if not self.force():
            if confirm(message):
                message = "Are you sure you want to delete {}? This will delete any changes made to your loadable data".format(
                    str(data_to_load_path))
                if confirm(message):
                    logger().warning(
                        "My the gods grant you mercy. Deleting {}".format(
                            str(data_to_load_path)))
                    shutil.rmtree(str(data_to_load_path))
                    exit(0)
        else:
            message = "You opted to force delete load data. Interesting choice."
            logger().warning(message)
            shutil.rmtree(str(data_to_load_path))
            exit(0)

        logger().warning("I guess we won't do that then. Smart choice")
Ejemplo n.º 3
0
    def run(self):
        self.log_start()
        data_to_load_path = Path(minerva_path('load'))
        database_path = Path(minerva_path('manager.sqlite'))

        if not database_path.is_file():
            if not data_to_load_path.is_dir():
                raise DataToLoadDirNotFound(data_to_load_path)
            logger().info("Creating database file for manager at {}".format(
                str(database_path)))
            database_path.touch()

        load_database_tables()

        if not self.app_conf.get('loaded', 0):
            self.load_manager_data_full(data_to_load_path)
        else:
            self.load_manager_data_update(data_to_load_path)
Ejemplo n.º 4
0
    def run(self):
        self.log_start()
        database_path = Path(minerva_path('manager.sqlite'))

        if not database_path.is_file():
            logger().warning(
                "Manager database path does not exist. Skipping".format(
                    str(database_path)))
            return

        message = "Do you really want to destroy the manager database"
        if not self.force():
            if confirm(message):
                logger().warning("Deleting manager database")
                database_path.unlink()
                exit(0)
            else:
                logger().warning("I guess we won't do that then")
        else:
            logger().warning("Deleting manager database by force")
            database_path.unlink()
Ejemplo n.º 5
0
def get_engine():
    global _engine
    if _engine == None:
        _engine = create_engine('sqlite:///{}'.format(
            minerva_path('manager.sqlite')))
    return _engine