Oleksiy Petrenko | 777d782 | 2018-11-06 13:32:44 +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 designatev2 import lists |
| 9 | from designatev2 import zones |
sgarbuz | 0ebf574 | 2018-11-21 17:39:45 +0200 | [diff] [blame] | 10 | from designatev2 import services |
Oleksiy Petrenko | 777d782 | 2018-11-06 13:32:44 +0200 | [diff] [blame] | 11 | |
| 12 | zone_list = lists.zone_list |
sgarbuz | 0ebf574 | 2018-11-21 17:39:45 +0200 | [diff] [blame] | 13 | status_list = lists.status_list |
| 14 | service_wait = services.wait_for_services |
Oleksiy Petrenko | 777d782 | 2018-11-06 13:32:44 +0200 | [diff] [blame] | 15 | zone_create = zones.zone_create |
| 16 | zone_get_details = zones.zone_get_details |
| 17 | zone_get_name_servers = zones.zone_get_name_servers |
| 18 | zone_update = zones.zone_update |
| 19 | zone_delete = zones.zone_delete |
| 20 | |
| 21 | |
sgarbuz | 0ebf574 | 2018-11-21 17:39:45 +0200 | [diff] [blame] | 22 | __all__ = ('zone_list', 'status_list', 'service_wait', 'zone_create', 'zone_delete', 'zone_update', |
Oleksiy Petrenko | 777d782 | 2018-11-06 13:32:44 +0200 | [diff] [blame] | 23 | 'zone_get_details', 'zone_get_name_servers',) |
| 24 | |
| 25 | |
| 26 | def __virtual__(): |
| 27 | """Only load designatev2 if requirements are available.""" |
| 28 | if REQUIREMENTS_MET: |
| 29 | return 'designatev2' |
| 30 | else: |
| 31 | return False, ("The designatev2 execution module cannot be loaded: " |
| 32 | "os_client_config or keystoneauth are unavailable.") |