~joeborg/charms/trusty/contrail-configuration/rbac-switch

« back to all changes in this revision

Viewing changes to hooks/contrail_configuration_utils.py

  • Committer: Robert Ayres
  • Date: 2016-09-29 20:44:06 UTC
  • mfrom: (59.1.1 contrail-configuration)
  • Revision ID: robert.ayres@canonical.com-20160929204406-dpkuu3q2s6ecrsmq
Merge Ante Karamatic's changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
    return 8082
128
128
 
129
129
def cassandra_ctx():
130
 
    servers = [ gethostbyname(relation_get("private-address", unit, rid))
 
130
    servers = [ (host if host \
 
131
                  else gethostbyname(relation_get("private-address", unit, rid)))
131
132
                + ":" + (rpc_port if rpc_port else port)
132
133
                for rid in relation_ids("cassandra")
133
 
                for unit, rpc_port, port in
134
 
                ((unit, relation_get("rpc_port", unit, rid), relation_get("port", unit, rid))
 
134
                for unit, host, rpc_port, port in
 
135
                ((unit, relation_get("host", unit, rid),
 
136
                  relation_get("rpc_port", unit, rid),
 
137
                  relation_get("port", unit, rid))
135
138
                 for unit in related_units(rid))
136
139
                if rpc_port or port ] \
137
140
              if config.get("cassandra-ready") else []
518
521
    render("vnc_api_lib.ini", "/etc/contrail/vnc_api_lib.ini", ctx)
519
522
 
520
523
def zookeeper_ctx():
521
 
    return { "zk_servers": [ gethostbyname(relation_get("private-address", unit, rid))
 
524
    return { "zk_servers": [ (host if host \
 
525
                               else gethostbyname(relation_get("private-address", unit, rid)))
522
526
                             + ":" + port
523
527
                             for rid in relation_ids("zookeeper")
524
 
                             for unit, port in
525
 
                             ((unit, relation_get("port", unit, rid)) for unit in related_units(rid))
 
528
                             for unit, host, port in
 
529
                             ((unit, relation_get("host", unit, rid),
 
530
                               relation_get("port", unit, rid))
 
531
                              for unit in related_units(rid))
526
532
                             if port ] }