def destroy_instance(self, instance_name):
        """
        Destroys the database and contents of the instance completely
        """
        INSTANCE_DIR = os.path.join(icc.DEFAULT_INSTANCE_DIR, instance_name)
        # Ensure we can import the instance settings
        sys.path.insert(0, INSTANCE_DIR)
        try:
            import instance_settings
        except:
            self.abort(' [ERROR] Couldn\'t import the instance settings to '
                       'destroy it. Check that it exists. Aborting.')
        try:
            instance_db_name = instance_settings.DATABASE_NAME
            dropdb = subprocess.Popen('su - postgres -c "dropdb %s"' %
                                      instance_db_name, shell=True)
            dropdb.wait()
            shutil.rmtree(INSTANCE_DIR)
            os.remove(os.path.join('/etc', 'supervisord.d',
                                   'openmooc-askbot-%s.conf' % instance_name))
            print(' [ OK ] Instance {0} destroyed.'.format(instance_name))
        except:
            self.abort(' [ERROR] Couldn\'t drop database or remove instance '
                       'files. Aborting.')
dataset/ETHPy150Open OpenMOOC/askbot-openmooc/askbotopenmooc/utils/openmooc-askbot-instancetool.py/AskbotInstance.destroy_instance/original