~corey.bryant/charms/trusty/ceilometer/git-ods

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/context.py

  • Committer: james.page at ubuntu
  • Date: 2015-01-13 12:04:23 UTC
  • Revision ID: james.page@ubuntu.com-20150113120423-wiu3pjjcbddl7atd
[trivial] Resync helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
468
468
                            _unit = unit.replace('/', '-')
469
469
                            cluster_hosts[laddr]['backends'][_unit] = _laddr
470
470
 
471
 
        # NOTE(jamespage) no split configurations found, just use
472
 
        # private addresses
473
 
        if not cluster_hosts:
474
 
            netmask = get_netmask_for_address(addr)
475
 
            cluster_hosts[addr] = {'network': "{}/{}".format(addr, netmask),
476
 
                                   'backends': {l_unit: addr}}
477
 
            for rid in relation_ids('cluster'):
478
 
                for unit in related_units(rid):
479
 
                    _laddr = relation_get('private-address',
480
 
                                          rid=rid, unit=unit)
481
 
                    if _laddr:
482
 
                        _unit = unit.replace('/', '-')
483
 
                        cluster_hosts[addr]['backends'][_unit] = _laddr
 
471
        # NOTE(jamespage) add backend based on private address - this
 
472
        # with either be the only backend or the fallback if no acls
 
473
        # match in the frontend
 
474
        cluster_hosts[addr] = {}
 
475
        netmask = get_netmask_for_address(addr)
 
476
        cluster_hosts[addr] = {'network': "{}/{}".format(addr, netmask),
 
477
                               'backends': {l_unit: addr}}
 
478
        for rid in relation_ids('cluster'):
 
479
            for unit in related_units(rid):
 
480
                _laddr = relation_get('private-address',
 
481
                                      rid=rid, unit=unit)
 
482
                if _laddr:
 
483
                    _unit = unit.replace('/', '-')
 
484
                    cluster_hosts[addr]['backends'][_unit] = _laddr
484
485
 
485
 
        ctxt = {'frontends': cluster_hosts}
 
486
        ctxt = {
 
487
            'frontends': cluster_hosts,
 
488
            'default_backend': addr
 
489
        }
486
490
 
487
491
        if config('haproxy-server-timeout'):
488
492
            ctxt['haproxy_server_timeout'] = config('haproxy-server-timeout')