Oleksiy Petrenko | 5013e68 | 2018-11-16 14:26:36 +0200 | [diff] [blame] | 1 | try: |
| 2 | import os_client_config # noqa |
| 3 | from keystoneauth1 import exceptions as ka_exceptions # noqa |
| 4 | REQUIREMENTS_MET = True |
| 5 | except ImportError: |
| 6 | REQUIREMENTS_MET = False |
| 7 | |
| 8 | from aodhv2 import lists |
| 9 | from aodhv2 import alarms |
| 10 | |
| 11 | alarm_list = lists.alarm_list |
| 12 | alarm_create = alarms.alarm_create |
| 13 | alarm_get_details = alarms.alarm_get_details |
| 14 | alarm_update = alarms.alarm_update |
| 15 | alarm_delete = alarms.alarm_delete |
| 16 | alarm_history_get = alarms.alarm_history_get |
| 17 | alarm_state_set = alarms.alarm_state_set |
| 18 | alarm_state_get = alarms.alarm_state_get |
| 19 | |
| 20 | |
| 21 | __all__ = ('alarm_list', 'alarm_create', 'alarm_delete', 'alarm_get_details', |
| 22 | 'alarm_history_get', 'alarm_state_get', 'alarm_state_set', |
| 23 | 'alarm_update') |
| 24 | |
| 25 | |
| 26 | def __virtual__(): |
| 27 | """Only load aodhv2 if requirements are available.""" |
| 28 | if REQUIREMENTS_MET: |
| 29 | return 'aodhv2' |
| 30 | else: |
| 31 | return False, ("The aodhv2 execution module cannot be loaded: " |
| 32 | "os_client_config or keystoneauth are unavailable.") |