Oleksiy Petrenko | e2c8da2 | 2018-03-30 18:27:58 +0300 | [diff] [blame] | 1 | # Copyright 2018 Mirantis Inc |
| 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
| 16 | try: |
| 17 | import os_client_config |
| 18 | from keystoneauth1 import exceptions as ka_exceptions |
| 19 | REQUIREMENTS_MET = True |
| 20 | except ImportError: |
| 21 | REQUIREMENTS_MET = False |
| 22 | |
| 23 | from manilang import share_types |
Oleksandr Shyshko | c08432f | 2018-11-23 17:15:51 +0000 | [diff] [blame] | 24 | from manilang import services |
Oleksiy Petrenko | e2c8da2 | 2018-03-30 18:27:58 +0300 | [diff] [blame] | 25 | |
| 26 | list_share_types = share_types.list_share_types |
| 27 | create_share_type = share_types.create_share_type |
| 28 | set_share_type_extra_specs = share_types.set_share_type_extra_specs |
| 29 | unset_share_type_extra_specs = share_types.unset_share_type_extra_specs |
| 30 | delete_share_type = share_types.delete_share_type |
Oleksandr Shyshko | c08432f | 2018-11-23 17:15:51 +0000 | [diff] [blame] | 31 | service_list = services.service_list |
| 32 | service_update = services.service_update |
| 33 | service_wait = services.wait_for_service |
Oleksiy Petrenko | e2c8da2 | 2018-03-30 18:27:58 +0300 | [diff] [blame] | 34 | |
| 35 | __all__ = ( |
| 36 | 'list_share_types', 'create_share_type', |
| 37 | 'set_share_type_extra_specs', 'unset_share_type_extra_specs', |
Oleksandr Shyshko | c08432f | 2018-11-23 17:15:51 +0000 | [diff] [blame] | 38 | 'delete_share_type','service_list', 'service_update', 'service_wait', |
Oleksiy Petrenko | e2c8da2 | 2018-03-30 18:27:58 +0300 | [diff] [blame] | 39 | ) |
| 40 | |
| 41 | |
| 42 | def __virtual__(): |
| 43 | """Only load manilang if requirements are available.""" |
| 44 | if REQUIREMENTS_MET: |
| 45 | return 'manilang' |
| 46 | else: |
| 47 | return False, ("The manilang execution module cannot be loaded: " |
| 48 | "os_client_config or keystoneauth are unavailable.") |