Oleksiy Petrenko | 2652ac1 | 2018-04-16 17:40:13 +0300 | [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 glancev2 import image |
| 9 | from glancev2 import task |
| 10 | |
| 11 | image_create = image.image_create |
| 12 | image_delete = image.image_delete |
| 13 | image_deactivate = image.image_deactivate |
| 14 | image_reactivate = image.image_reactivate |
| 15 | image_list = image.image_list |
| 16 | image_update = image.image_update |
| 17 | image_download = image.image_data_download |
| 18 | image_get_details = image.image_get_details |
| 19 | task_list = task.task_list |
| 20 | task_create = task.task_create |
| 21 | task_show = task.task_show |
| 22 | |
| 23 | __all__ = ( |
| 24 | 'image_update', 'image_create', 'image_list', 'image_delete', 'task_show', |
| 25 | 'image_download', 'task_create', 'task_list', 'image_get_details', |
| 26 | 'image_deactivate', 'image_reactivate' |
| 27 | ) |
| 28 | |
| 29 | |
| 30 | def __virtual__(): |
| 31 | """Only load glanceng if requirements are available.""" |
| 32 | if REQUIREMENTS_MET: |
| 33 | return 'glancev2' |
| 34 | else: |
| 35 | return False, ("The glanceng execution module cannot be loaded: " |
| 36 | "os_client_config or keystoneauth are unavailable.") |