()
| 246 | |
| 247 | |
| 248 | def register_actions(): |
| 249 | # Register runnertypes and actions. The order is important because actions require action |
| 250 | # types to be present in the system. |
| 251 | pack_dir = cfg.CONF.register.pack |
| 252 | fail_on_failure = not cfg.CONF.register.no_fail_on_failure |
| 253 | |
| 254 | registered_count = 0 |
| 255 | overridden_count = 0 |
| 256 | |
| 257 | try: |
| 258 | LOG.info("=========================================================") |
| 259 | LOG.info("############## Registering actions ######################") |
| 260 | LOG.info("=========================================================") |
| 261 | with Timer(key="st2.register.actions"): |
| 262 | registered_count, overridden_count = actions_registrar.register_actions( |
| 263 | pack_dir=pack_dir, |
| 264 | fail_on_failure=fail_on_failure, |
| 265 | use_runners_cache=True, |
| 266 | ) |
| 267 | except Exception as e: |
| 268 | exc_info = not fail_on_failure |
| 269 | LOG.warning("Failed to register actions: %s", e, exc_info=exc_info) |
| 270 | |
| 271 | if fail_on_failure: |
| 272 | raise e |
| 273 | |
| 274 | LOG.info("Registered %s actions." % (registered_count)) |
| 275 | LOG.info("%s actions had their metadata overridden." % (overridden_count)) |
| 276 | |
| 277 | |
| 278 | def register_rules(): |
no test coverage detected