2 # -------------------------------------------------------------------------
3 # Copyright (c) 2015-2017 AT&T Intellectual Property
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # -------------------------------------------------------------------------
20 """Music - Common Methods"""
22 from oslo_log import log as logging
24 from conductor.common.music import api
26 LOG = logging.getLogger(__name__)
29 def music_api(configuration):
30 """Create or return a Music API instance"""
32 configuration = dict(configuration)
34 'host': configuration.get('host'),
35 'port': configuration.get('port'),
36 'replication_factor': configuration.get('replication_factor'),
38 api_instance = api.API(**kwargs)
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)