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 |
| 10 | |
| 11 | zone_list = lists.zone_list |
| 12 | zone_create = zones.zone_create |
| 13 | zone_get_details = zones.zone_get_details |
| 14 | zone_get_name_servers = zones.zone_get_name_servers |
| 15 | zone_update = zones.zone_update |
| 16 | zone_delete = zones.zone_delete |
| 17 | |
| 18 | |
| 19 | __all__ = ('zone_list', 'zone_create', 'zone_delete', 'zone_update', |
| 20 | 'zone_get_details', 'zone_get_name_servers',) |
| 21 | |
| 22 | |
| 23 | def __virtual__(): |
| 24 | """Only load designatev2 if requirements are available.""" |
| 25 | if REQUIREMENTS_MET: |
| 26 | return 'designatev2' |
| 27 | else: |
| 28 | return False, ("The designatev2 execution module cannot be loaded: " |
| 29 | "os_client_config or keystoneauth are unavailable.") |