Mykyta Karpin | fa53b30 | 2018-06-13 14:52: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 gnocchiv1 import archive_policy |
| 9 | |
| 10 | archive_policy_create = archive_policy.archive_policy_create |
| 11 | archive_policy_delete = archive_policy.archive_policy_delete |
| 12 | archive_policy_list = archive_policy.archive_policy_list |
| 13 | archive_policy_update = archive_policy.archive_policy_update |
| 14 | archive_policy_read = archive_policy.archive_policy_read |
| 15 | |
| 16 | archive_policy_rule_create = archive_policy.archive_policy_rule_create |
| 17 | archive_policy_rule_delete = archive_policy.archive_policy_rule_delete |
| 18 | archive_policy_rule_list = archive_policy.archive_policy_rule_list |
| 19 | archive_policy_rule_read = archive_policy.archive_policy_rule_read |
| 20 | |
| 21 | __all__ = ( |
| 22 | 'archive_policy_update', 'archive_policy_create', 'archive_policy_list', 'archive_policy_delete', |
| 23 | 'archive_policy_read', 'archive_policy_rule_create', 'archive_policy_rule_delete', 'archive_policy_rule_list', |
| 24 | 'archive_policy_rule_read' |
| 25 | ) |
| 26 | |
| 27 | def __virtual__(): |
| 28 | """Only load gnocchiv1 if requirements are available.""" |
| 29 | if REQUIREMENTS_MET: |
| 30 | return 'gnocchiv1' |
| 31 | else: |
| 32 | return False, ("The gnocchiv1 execution module cannot be loaded: " |
| 33 | "os_client_config or keystoneauth are unavailable.") |