Oleksiy Petrenko | 95664c0 | 2018-04-19 17:05:16 +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 barbicanv1 import secrets |
| 9 | from barbicanv1 import acl |
| 10 | |
| 11 | secret_list = secrets.secret_list |
| 12 | secret_create = secrets.secret_create |
| 13 | secret_delete = secrets.secret_delete |
| 14 | secret_get_details = secrets.secret_get_details |
| 15 | secret_payload_get = secrets.secret_payload_get |
| 16 | secret_payload_set = secrets.secret_payload_set |
| 17 | secret_acl_get = acl.secret_acl_get |
| 18 | secret_acl_put = acl.secret_acl_put |
| 19 | secret_acl_patch = acl.secret_acl_patch |
| 20 | secret_acl_delete = acl.secret_acl_delete |
| 21 | |
| 22 | __all__ = ( |
| 23 | 'secret_list', 'secret_create', 'secret_delete', 'secret_get_details', |
| 24 | 'secret_payload_get', 'secret_payload_set', 'secret_acl_delete', |
| 25 | 'secret_acl_get', 'secret_acl_patch', 'secret_acl_put', |
| 26 | ) |
| 27 | |
| 28 | |
| 29 | def __virtual__(): |
| 30 | """Only load barbicanv1 if requirements are available.""" |
| 31 | if REQUIREMENTS_MET: |
| 32 | return 'barbicanv1' |
| 33 | else: |
| 34 | return False, ("The barbicanv1 execution module cannot be loaded: " |
| 35 | "os_client_config or keystoneauth are unavailable.") |