Ejemplo n.º 1
0
Archivo: afm.py Proyecto: SLAMon/SLAMon
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        }
    },
    'loggers': {
        'tasks': {
            'handlers': ['console'],
            'propagate': True,
            'level': 'INFO',
        },
        'testing': {
            'handlers': ['console'],
            'propagate': True,
            'level': 'DEBUG'
        }
    }
}

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)

    from slamon.afm.routes import agent_routes, bpms_routes, status_routes

    if Settings.testing_urls_available:
            from slamon.afm.routes.testing import testing_routes

    init_connection()
    run(afm_app.app, host='0.0.0.0', port=Settings.port, debug=True)
Ejemplo n.º 2
0
import sys

logger = logging.getLogger('admin')


def create_tables():
    logger.info('Creating tables')
    Base.metadata.create_all(engine)


def drop_tables():
    logger.info('Dropping tables')
    Base.metadata.drop_all(engine)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Admin util for SLAMon Agent Fleet Manager')
    parser.add_argument('--create-tables', help='Create tables', action='store_true', default=False)
    parser.add_argument('--drop-tables', help='Drop all tables', action='store_true', default=False)

    init_connection(unittest=False)

    args = parser.parse_args()
    if args.create_tables is True:
        create_tables()
    elif args.drop_tables is True:
        drop_tables()
    else:
        parser.print_help()
        sys.exit(1)
    def test_status_broken_session():
        test_app = TestApp(app)
        os.environ['OPENSHIFT_POSTGRESQL_DB_URL'] = 'postgresql+psycopg2://slamon:slamon@localhost/whatever'
        init_connection()

        assert test_app.get('/status', expect_errors=True).status_int == 500
Ejemplo n.º 4
0
    def setup(self):
        init_connection(unittest=True)

        self.create_tables()
Ejemplo n.º 5
0
    Base.metadata.create_all(engine)


def drop_tables():
    logger.info('Dropping tables')
    Base.metadata.drop_all(engine)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='Admin util for SLAMon Agent Fleet Manager')
    parser.add_argument('--create-tables',
                        help='Create tables',
                        action='store_true',
                        default=False)
    parser.add_argument('--drop-tables',
                        help='Drop all tables',
                        action='store_true',
                        default=False)

    init_connection(unittest=False)

    args = parser.parse_args()
    if args.create_tables is True:
        create_tables()
    elif args.drop_tables is True:
        drop_tables()
    else:
        parser.print_help()
        sys.exit(1)