2
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
16
from charmhelpers.core import hookenv
17
from charmhelpers.core.services import helpers
20
class MidonetApiRelation(helpers.RelationContext):
25
def __init__(self, *args, **kwargs):
26
self.required_keys = ['host', 'port']
27
helpers.RelationContext.__init__(self, *args, **kwargs)
29
def provide_data(self):
31
'host': hookenv.unit_get('private-address'),
36
class KeystoneAdminRelation(helpers.RelationContext):
38
interface = 'keystone-admin'
40
def __init__(self, *args, **kwargs):
41
self.required_keys = ['service_hostname', 'service_port',
42
'service_username', 'service_tenant_name',
43
'service_region', 'service_password']
44
helpers.RelationContext.__init__(self, *args, **kwargs)
47
class ZookeeperRelation(helpers.RelationContext):
49
interface = 'zookeeper'
51
def __init__(self, *args, **kwargs):
52
self.required_keys = ['private-address', 'port']
53
helpers.RelationContext.__init__(self, *args, **kwargs)
56
class RepositoryRelation(helpers.RelationContext):
58
interface = 'midonet-repository'
59
# The keys are not required since we'll get the puppet defaults if not