~celebdor/charms/trusty/midonet-gateway/fake

« back to all changes in this revision

Viewing changes to hooks/midonet_helpers/relations.py

  • Committer: Antoni Segura Puimedon
  • Date: 2015-12-21 01:14:08 UTC
  • Revision ID: toni@midokura.com-20151221011408-tdcv1pec67th7ckr
ultra bare bones charm for just pulling midonet-agent

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
3
 
#
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
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,
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.
15
 
#
16
 
from charmhelpers.core import hookenv
17
 
from charmhelpers.core.services import helpers
18
 
 
19
 
 
20
 
class MidonetApiRelation(helpers.RelationContext):
21
 
    name = 'midonet-api'
22
 
    interface = 'midonet'
23
 
    port = 8080
24
 
 
25
 
    def __init__(self, *args, **kwargs):
26
 
        self.required_keys = ['host', 'port']
27
 
        helpers.RelationContext.__init__(self, *args, **kwargs)
28
 
 
29
 
    def provide_data(self):
30
 
        return {
31
 
            'host': hookenv.unit_get('private-address'),
32
 
            'port': self.port,
33
 
        }
34
 
 
35
 
 
36
 
class KeystoneAdminRelation(helpers.RelationContext):
37
 
    name = 'keystone'
38
 
    interface = 'keystone-admin'
39
 
 
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)
45
 
 
46
 
 
47
 
class ZookeeperRelation(helpers.RelationContext):
48
 
    name = 'zookeeper'
49
 
    interface = 'zookeeper'
50
 
 
51
 
    def __init__(self, *args, **kwargs):
52
 
        self.required_keys = ['private-address', 'port']
53
 
        helpers.RelationContext.__init__(self, *args, **kwargs)
54
 
 
55
 
 
56
 
class RepositoryRelation(helpers.RelationContext):
57
 
    name = 'repository'
58
 
    interface = 'midonet-repository'
59
 
    # The keys are not required since we'll get the puppet defaults if not
60
 
    # set.