Example #1
0
 def do_emptydb(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
     (pid_alive, m2ee_alive) = self.m2ee.check_alive()
     if pid_alive or m2ee_alive:
         logger.warn("The application process is still running, refusing "
                     "to empty the database right now.")
         return
     pgutil.emptydb(
         self.m2ee.config.get_pg_environment(),
         self.m2ee.config.get_psql_binary(),
     )
Example #2
0
 def do_emptydb(self, args):
     if not self.m2ee.config.is_using_postgresql():
         logger.error("Only PostgreSQL databases are supported right now.")
         return
     (pid_alive, m2ee_alive) = self.m2ee.check_alive()
     if pid_alive or m2ee_alive:
         logger.warn("The application process is still running, refusing "
                     "to empty the database right now.")
         return
     logger.info("This command will drop all tables and sequences in "
                 "database %s." %
                 self.m2ee.config.get_pg_environment()['PGDATABASE'])
     answer = raw_input("Continue? (y)es, (N)o? ")
     if answer != 'y':
         print("Aborting!")
         return
     pgutil.emptydb(self.m2ee.config)
Example #3
0
 def do_emptydb(self, args):
     if not self.m2ee.config.is_using_postgresql():
         logger.error("Only PostgreSQL databases are supported right now.")
         return
     (pid_alive, m2ee_alive) = self.m2ee.check_alive()
     if pid_alive or m2ee_alive:
         logger.warn("The application process is still running, refusing "
                     "to empty the database right now.")
         return
     logger.info("This command will drop all tables and sequences in "
                 "database %s." %
                 self.m2ee.config.get_pg_environment()['PGDATABASE'])
     answer = ('y'
               if self.yolo_mode else raw_input("Continue? (y)es, (N)o? "))
     if answer != 'y':
         print("Aborting!")
         return
     pgutil.emptydb(self.m2ee.config)
Example #4
0
 def do_emptydb(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
     (pid_alive, m2ee_alive) = self.m2ee.check_alive()
     if pid_alive or m2ee_alive:
         logger.warn("The application process is still running, refusing "
                     "to empty the database right now.")
         return
     logger.info("This command will drop all tables and sequences in "
                 "database %s." %
                 self.m2ee.config.get_pg_environment()['PGDATABASE'])
     answer = ('y' if self.yolo_mode
               else raw_input("Continue? (y)es, (N)o? "))
     if answer != 'y':
         print("Aborting!")
         return
     pgutil.emptydb(self.m2ee.config)