def do_restoredb(self, args): if not self.m2ee.config.allow_destroy_db(): logger.error("Refusing to do a destructive database operation " "because the allow_destroy_db configuration option " "is set to false.") return if not self.m2ee.config.is_using_postgresql(): logger.error("Only PostgreSQL databases are supported right now.") return if not args: logger.error("restoredb needs the name of a dump file in %s as arg" "ument" % self.m2ee.config.get_database_dump_path()) return (pid_alive, m2ee_alive) = self.m2ee.check_alive() if pid_alive or m2ee_alive: logger.warn("The application is still running, refusing to " "restore the database right now.") return database_name = self.m2ee.config.get_pg_environment()['PGDATABASE'] answer = ('y' if self.yolo_mode else raw_input("This command will restore this dump into database " "%s. Continue? (y)es, (N)o? " % database_name)) if answer != 'y': logger.info("Aborting!") return pgutil.restoredb(self.m2ee.config, args)
def do_restoredb(self, args): if not self.m2ee.config.allow_destroy_db(): logger.error("Refusing to do a destructive database operation " "because the allow_destroy_db configuration option " "is set to false.") return if not self.m2ee.config.is_using_postgresql(): logger.error("Only PostgreSQL databases are supported right now.") return if not args: logger.error("restoredb needs the name of a dump file in %s as arg" "ument" % self.m2ee.config.get_database_dump_path()) return (pid_alive, m2ee_alive) = self.m2ee.check_alive() if pid_alive or m2ee_alive: logger.warn("The application is still running, refusing to " "restore the database right now.") return database_name = self.m2ee.config.get_pg_environment()['PGDATABASE'] answer = ('y' if self.yolo_mode else raw_input( "This command will restore this dump into database " "%s. Continue? (y)es, (N)o? " % database_name)) if answer != 'y': logger.info("Aborting!") return pgutil.restoredb(self.m2ee.config, args)
def do_restoredb(self, args): if not self.m2ee.config.is_using_postgresql(): logger.error("Only PostgreSQL databases are supported right now.") return if not self.m2ee.config.allow_destroy_db(): logger.error("Destructive database operations are turned off.") return if not args: logger.error("restoredb needs the name of a dump file in %s as arg" "ument" % self.m2ee.config.get_database_dump_path()) return (pid_alive, m2ee_alive) = self.m2ee.check_alive() if pid_alive or m2ee_alive: logger.warn("The application is still running, refusing to " "restore the database right now.") return pgutil.restoredb( self.m2ee.config.get_pg_environment(), self.m2ee.config.get_pg_restore_binary(), self.m2ee.config.get_database_dump_path(), args, )