Exemplo n.º 1
0
 def test_register_actions_from_bad_pack(self):
     packs_base_path = tests_base.get_fixtures_path()
     try:
         actions_registrar.register_actions(packs_base_paths=[packs_base_path])
         self.fail('Should have thrown.')
     except:
         pass
Exemplo n.º 2
0
 def test_register_actions_from_bad_pack(self):
     packs_base_path = tests_base.get_fixtures_path()
     try:
         actions_registrar.register_actions(packs_base_paths=[packs_base_path])
         self.fail('Should have thrown.')
     except:
         pass
Exemplo n.º 3
0
 def test_register_all_actions(self):
     try:
         packs_base_path = os.path.join(tests_base.get_fixtures_path())
         all_actions_in_db = Action.get_all()
         actions_registrar.register_actions(packs_base_path=packs_base_path)
         all_actions_in_db = Action.get_all()
         self.assertTrue(len(all_actions_in_db) > 0)
     except Exception as e:
         print(str(e))
         self.fail('All actions must be registered without exceptions.')
Exemplo n.º 4
0
 def test_register_all_actions(self):
     try:
         packs_base_path = fixtures_loader.get_fixtures_base_path()
         all_actions_in_db = Action.get_all()
         actions_registrar.register_actions(packs_base_paths=[packs_base_path])
     except Exception as e:
         print(str(e))
         self.fail('All actions must be registered without exceptions.')
     else:
         all_actions_in_db = Action.get_all()
         self.assertTrue(len(all_actions_in_db) > 0)
Exemplo n.º 5
0
 def test_register_all_actions(self):
     try:
         packs_base_path = fixtures_loader.get_fixtures_base_path()
         all_actions_in_db = Action.get_all()
         actions_registrar.register_actions(packs_base_paths=[packs_base_path])
     except Exception as e:
         print(str(e))
         self.fail('All actions must be registered without exceptions.')
     else:
         all_actions_in_db = Action.get_all()
         self.assertTrue(len(all_actions_in_db) > 0)
Exemplo n.º 6
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    try:
        runners_registrar.register_runner_types()
    except Exception as e:
        LOG.warning('Failed to register action types: %s', e, exc_info=True)
        LOG.warning('Not registering stock actions.')
    else:
        try:
            actions_registrar.register_actions()
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)
Exemplo n.º 7
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    try:
        runners_registrar.register_runner_types()
    except Exception as e:
        LOG.warning('Failed to register action types: %s', e, exc_info=True)
        LOG.warning('Not registering stock actions.')
    else:
        try:
            actions_registrar.register_actions()
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)
Exemplo n.º 8
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    registered_count = 0

    try:
        LOG.info('=========================================================')
        LOG.info('############## Registering actions ######################')
        LOG.info('=========================================================')
        # Importing here to reduce scope of dependency. This way even if st2action
        # is not installed bootstrap continues.
        import st2actions.bootstrap.runnersregistrar as runners_registrar
        runners_registrar.register_runner_types(experimental=cfg.CONF.experimental)
    except Exception as e:
        LOG.warning('Failed to register runner types: %s', e, exc_info=True)
        LOG.warning('Not registering stock runners .')
    else:
        try:
            # Importing here to reduce scope of dependency. This way even if st2action
            # is not installed bootstrap continues.
            import st2actions.bootstrap.actionsregistrar as actions_registrar
            registered_count = actions_registrar.register_actions(pack_dir=cfg.CONF.register.pack)
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)

    LOG.info('Registered %s actions.' % (registered_count))
Exemplo n.º 9
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    try:
        LOG.info('=========================================================')
        LOG.info('############## Registering actions ######################')
        LOG.info('=========================================================')
        # Importing here to reduce scope of dependency. This way even if st2action
        # is not installed bootstrap continues.
        import st2actions.bootstrap.runnersregistrar as runners_registrar
        runners_registrar.register_runner_types()
    except Exception as e:
        LOG.warning('Failed to register runner types: %s', e, exc_info=True)
        LOG.warning('Not registering stock runners .')
    else:
        try:
            # Importing here to reduce scope of dependency. This way even if st2action
            # is not installed bootstrap continues.
            import st2actions.bootstrap.actionsregistrar as actions_registrar
            registered_count = actions_registrar.register_actions(
                pack_dir=cfg.CONF.register.pack)
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)

    LOG.info('Registered %s actions.' % (registered_count))