blob: 4d0b401e15a76a0930732446edf92ebcd37ea86b [file] [log] [blame]
Oleksiy Petrenkoe2c8da22018-03-30 18:27:58 +03001# 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
16try:
17 import os_client_config
18 from keystoneauth1 import exceptions as ka_exceptions
19 REQUIREMENTS_MET = True
20except ImportError:
21 REQUIREMENTS_MET = False
22
23from manilang import share_types
24
25list_share_types = share_types.list_share_types
26create_share_type = share_types.create_share_type
27set_share_type_extra_specs = share_types.set_share_type_extra_specs
28unset_share_type_extra_specs = share_types.unset_share_type_extra_specs
29delete_share_type = share_types.delete_share_type
30
31
32__all__ = (
33 'list_share_types', 'create_share_type',
34 'set_share_type_extra_specs', 'unset_share_type_extra_specs',
35 'delete_share_type',
36)
37
38
39def __virtual__():
40 """Only load manilang if requirements are available."""
41 if REQUIREMENTS_MET:
42 return 'manilang'
43 else:
44 return False, ("The manilang execution module cannot be loaded: "
45 "os_client_config or keystoneauth are unavailable.")