Oleg Bondarev | 9250e61 | 2018-09-24 18:59:40 +0400 | [diff] [blame] | 1 | try: |
| 2 | import os_client_config |
| 3 | from keystoneauth1 import exceptions as ka_exceptions |
| 4 | REQUIREMENTS_MET = True |
| 5 | except ImportError: |
| 6 | REQUIREMENTS_MET = False |
| 7 | |
| 8 | from octaviav2 import loadbalancers |
| 9 | |
| 10 | |
| 11 | loadbalancer_list = loadbalancers.loadbalancer_list |
| 12 | loadbalancer_get_details = loadbalancers.loadbalancer_get_details |
| 13 | loadbalancer_update = loadbalancers.loadbalancer_update |
| 14 | loadbalancer_delete = loadbalancers.loadbalancer_delete |
| 15 | loadbalancer_create = loadbalancers.loadbalancer_create |
| 16 | |
| 17 | |
| 18 | __all__ = ( |
| 19 | 'loadbalancer_get_details', 'loadbalancer_update', 'loadbalancer_delete', |
| 20 | 'loadbalancer_list', 'loadbalancer_create', |
| 21 | ) |
| 22 | |
| 23 | |
| 24 | def __virtual__(): |
| 25 | """Only load neutronv2 if requirements are available.""" |
| 26 | if REQUIREMENTS_MET: |
| 27 | return 'octaviav2' |
| 28 | else: |
| 29 | return False, ("The octaviav2 execution module cannot be loaded: " |
| 30 | "os_client_config or keystoneauth are unavailable.") |