def setUpClass(cls): super(SensorContainerTestCase, cls).setUpClass() st2tests.config.parse_args() username = cfg.CONF.database.username if hasattr( cfg.CONF.database, 'username') else None password = cfg.CONF.database.password if hasattr( cfg.CONF.database, 'password') else None cls.db_connection = db_setup(cfg.CONF.database.db_name, cfg.CONF.database.host, cfg.CONF.database.port, username=username, password=password, ensure_indexes=False) # Register sensors register_sensors(packs_base_paths=[PACKS_BASE_PATH], use_pack_cache=False) # Create virtualenv for examples pack virtualenv_path = '/tmp/virtualenvs/examples' run_command(cmd=['rm', '-rf', virtualenv_path]) cmd = [ 'virtualenv', '--system-site-packages', '--python', PYTHON_BINARY, virtualenv_path ] run_command(cmd=cmd)
def setUpClass(cls): super(SensorContainerTestCase, cls).setUpClass() return st2tests.config.parse_args() username = cfg.CONF.database.username if hasattr( cfg.CONF.database, 'username') else None password = cfg.CONF.database.password if hasattr( cfg.CONF.database, 'password') else None cls.db_connection = db_setup(cfg.CONF.database.db_name, cfg.CONF.database.host, cfg.CONF.database.port, username=username, password=password, ensure_indexes=False) # Register sensors register_sensors(packs_base_paths=['/opt/stackstorm/packs'], use_pack_cache=False) # Create virtualenv for examples pack virtualenv_path = '/opt/stackstorm/virtualenvs/examples' cmd = ['virtualenv', '--system-site-packages', virtualenv_path] run_command(cmd=cmd)
def setUpClass(cls): super(SensorContainerTestCase, cls).setUpClass() st2tests.config.parse_args() username = cfg.CONF.database.username if hasattr( cfg.CONF.database, 'username') else None password = cfg.CONF.database.password if hasattr( cfg.CONF.database, 'password') else None cls.db_connection = db_setup(cfg.CONF.database.db_name, cfg.CONF.database.host, cfg.CONF.database.port, username=username, password=password, ensure_indexes=False) # NOTE: We need to perform this patching because test fixtures are located outside of the # packs base paths directory. This will never happen outside the context of test fixtures. cfg.CONF.content.packs_base_paths = PACKS_BASE_PATH # Register sensors register_sensors(packs_base_paths=[PACKS_BASE_PATH], use_pack_cache=False) # Create virtualenv for examples pack virtualenv_path = '/tmp/virtualenvs/examples' run_command(cmd=['rm', '-rf', virtualenv_path]) cmd = [ 'virtualenv', '--system-site-packages', '--python', PYTHON_BINARY, virtualenv_path ] run_command(cmd=cmd)
def setUpClass(cls): super(SensorContainerTestCase, cls).setUpClass() st2tests.config.parse_args() username = cfg.CONF.database.username if hasattr(cfg.CONF.database, 'username') else None password = cfg.CONF.database.password if hasattr(cfg.CONF.database, 'password') else None cls.db_connection = db_setup( cfg.CONF.database.db_name, cfg.CONF.database.host, cfg.CONF.database.port, username=username, password=password, ensure_indexes=False) # NOTE: We need to perform this patching because test fixtures are located outside of the # packs base paths directory. This will never happen outside the context of test fixtures. cfg.CONF.content.packs_base_paths = PACKS_BASE_PATH # Register sensors register_sensors(packs_base_paths=[PACKS_BASE_PATH], use_pack_cache=False) # Create virtualenv for examples pack virtualenv_path = '/tmp/virtualenvs/examples' run_command(cmd=['rm', '-rf', virtualenv_path]) cmd = ['virtualenv', '--system-site-packages', '--python', PYTHON_BINARY, virtualenv_path] run_command(cmd=cmd)
def setUpClass(cls): super(SensorContainerTestCase, cls).setUpClass() return st2tests.config.parse_args() username = cfg.CONF.database.username if hasattr(cfg.CONF.database, 'username') else None password = cfg.CONF.database.password if hasattr(cfg.CONF.database, 'password') else None cls.db_connection = db_setup( cfg.CONF.database.db_name, cfg.CONF.database.host, cfg.CONF.database.port, username=username, password=password, ensure_indexes=False) # Register sensors register_sensors(packs_base_paths=['/opt/stackstorm/packs'], use_pack_cache=False) # Create virtualenv for examples pack virtualenv_path = '/opt/stackstorm/virtualenvs/examples' cmd = ['virtualenv', '--system-site-packages', virtualenv_path] run_command(cmd=cmd)
def register_sensors(): registered_count = 0 try: LOG.info('=========================================================') LOG.info('############## Registering sensors ######################') LOG.info('=========================================================') registered_count = sensors_registrar.register_sensors(pack_dir=cfg.CONF.register.pack) except Exception as e: LOG.warning('Failed to register sensors: %s', e, exc_info=True) LOG.info('Registered %s sensors.' % (registered_count))
def setUpClass(cls): super(SensorContainerTestCase, cls).setUpClass() st2tests.config.parse_args() username = cfg.CONF.database.username if hasattr(cfg.CONF.database, 'username') else None password = cfg.CONF.database.password if hasattr(cfg.CONF.database, 'password') else None cls.db_connection = db_setup( cfg.CONF.database.db_name, cfg.CONF.database.host, cfg.CONF.database.port, username=username, password=password, ensure_indexes=False) # Register sensors register_sensors(packs_base_paths=[PACKS_BASE_PATH], use_pack_cache=False) # Create virtualenv for examples pack virtualenv_path = '/tmp/virtualenvs/examples' run_command(cmd=['rm', '-rf', virtualenv_path]) cmd = ['virtualenv', '--system-site-packages', '--python', PYTHON_BINARY, virtualenv_path] run_command(cmd=cmd)
def register_sensors(): registered_count = 0 try: LOG.info('=========================================================') LOG.info('############## Registering sensors ######################') LOG.info('=========================================================') registered_count = sensors_registrar.register_sensors( pack_dir=cfg.CONF.register.pack) except Exception as e: LOG.warning('Failed to register sensors: %s', e, exc_info=True) LOG.info('Registered %s sensors.' % (registered_count))
def register_sensors(): pack_dir = cfg.CONF.register.pack fail_on_failure = cfg.CONF.register.fail_on_failure registered_count = 0 try: LOG.info("=========================================================") LOG.info("############## Registering sensors ######################") LOG.info("=========================================================") registered_count = sensors_registrar.register_sensors(pack_dir=pack_dir, fail_on_failure=fail_on_failure) except Exception as e: exc_info = not fail_on_failure LOG.warning("Failed to register sensors: %s", e, exc_info=exc_info) if fail_on_failure: raise e LOG.info("Registered %s sensors." % (registered_count))
def register_sensors(): pack_dir = cfg.CONF.register.pack fail_on_failure = not cfg.CONF.register.no_fail_on_failure registered_count = 0 try: LOG.info('=========================================================') LOG.info('############## Registering sensors ######################') LOG.info('=========================================================') registered_count = sensors_registrar.register_sensors(pack_dir=pack_dir, fail_on_failure=fail_on_failure) except Exception as e: exc_info = not fail_on_failure LOG.warning('Failed to register sensors: %s', e, exc_info=exc_info) if fail_on_failure: raise e LOG.info('Registered %s sensors.' % (registered_count))
def register_sensors(): pack_dir = cfg.CONF.register.pack fail_on_failure = not cfg.CONF.register.no_fail_on_failure registered_count = 0 try: LOG.info('=========================================================') LOG.info('############## Registering sensors ######################') LOG.info('=========================================================') registered_count = sensors_registrar.register_sensors( pack_dir=pack_dir, fail_on_failure=fail_on_failure) except Exception as e: exc_info = not fail_on_failure LOG.warning('Failed to register sensors: %s', e, exc_info=exc_info) if fail_on_failure: raise e LOG.info('Registered %s sensors.' % (registered_count))
def register_sensors(): pack_dir = cfg.CONF.register.pack fail_on_failure = not cfg.CONF.register.no_fail_on_failure registered_count = 0 try: LOG.info("=========================================================") LOG.info("############## Registering sensors ######################") LOG.info("=========================================================") with Timer(key="st2.register.sensors"): registered_count = sensors_registrar.register_sensors( pack_dir=pack_dir, fail_on_failure=fail_on_failure) except Exception as e: exc_info = not fail_on_failure LOG.warning("Failed to register sensors: %s", e, exc_info=exc_info) if fail_on_failure: raise e LOG.info("Registered %s sensors." % (registered_count))
def setUpClass(cls): super(SensorTypeControllerTestCase, cls).setUpClass() # Register local sensor and pack fixtures sensors_registrar.register_sensors(use_pack_cache=False)