Added all common modules in conductor directory
[optf/has.git] / conductor / conductor / common / __init__.py
1 #
2 # -------------------------------------------------------------------------
3 #   Copyright (c) 2015-2017 AT&T Intellectual Property
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 #
17 # -------------------------------------------------------------------------
18 #
19
20 """Music - Common Methods"""
21
22 from oslo_log import log as logging
23
24 from conductor.common.music import api
25
26 LOG = logging.getLogger(__name__)
27
28
29 def music_api(configuration):
30     """Create or return a Music API instance"""
31
32     configuration = dict(configuration)
33     kwargs = {
34         'host': configuration.get('host'),
35         'port': configuration.get('port'),
36         'replication_factor': configuration.get('replication_factor'),
37     }
38     api_instance = api.API(**kwargs)
39
40     # Create the keyspace if necessary
41     # TODO(jdandrea): Use oslo.config with a [music] section
42     # keyspace = conf.music.get('keyspace')
43     # api_instance.create_keyspace(keyspace)
44     return api_instance