~sdn-charmers/charms/trusty/contrail-configuration/trunk

« back to all changes in this revision

Viewing changes to hooks/contrail_configuration_utils.py

  • Committer: Robert Ayres
  • Date: 2017-10-13 16:43:58 UTC
  • mfrom: (70.1.2 contrail-configuration)
  • Revision ID: robert.ayres@canonical.com-20171013164358-slqxcxw8fpf96h66
Merge Vincenzo's changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
            password = relation_get("password", unit, rid)
102
102
            if not password:
103
103
                continue
 
104
            port = relation_get("ssl_port", unit, rid)
 
105
            if port:
 
106
                ssl = True
 
107
            else:
 
108
                port = "5672"
 
109
                ssl = False
104
110
            ctxs.append({"rabbit_user": "contrail",
105
111
                         "rabbit_password": password,
106
 
                         "rabbit_vhost": "contrail"})
 
112
                         "rabbit_vhost": "contrail",
 
113
                         "rabbit_use_ssl": ssl})
107
114
            vip = relation_get("vip", unit, rid)
108
115
            server = (vip if vip \
109
 
              else gethostbyname(relation_get("hostname", unit, rid))) + ":5672"
 
116
              else gethostbyname(relation_get("hostname", unit, rid))) \
 
117
              + ":" + port
110
118
            servers[server] = None
111
119
    ctx = ctxs[0] if ctxs else {}
112
120
    ctx["rabbit_servers"] = servers.keys()