~junaidali/charms/trusty/plumgrid-gateway/oil-sapi-changes

« back to all changes in this revision

Viewing changes to hooks/pg_gw_context.py

  • Committer: Hassaan Pasha
  • Date: 2015-08-10 16:45:08 UTC
  • Revision ID: hassaanp@plumgrid.com-20150810164508-7h25vzubijofikid
Updated unit tests for HA

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
    '''
18
18
    Inspects relation with PLUMgrid director.
19
19
    '''
20
 
    director_ips=[]
 
20
    director_ips = []
21
21
    for rid in relation_ids('plumgrid'):
22
22
        for unit in related_units(rid):
23
23
            rdata = relation_get(rid=rid, unit=unit)
24
24
            director_ips.append(str(rdata['private-address']))
25
25
    return director_ips
26
26
 
 
27
 
27
28
class PGGwContext(context.NeutronContext):
28
29
 
29
30
    @property
63
64
        single_ip = True
64
65
        for ip in pg_dir_settings:
65
66
            if single_ip:
66
 
                pg_dir_ips=str(ip)
 
67
                pg_dir_ips = str(ip)
67
68
                single_ip = False
68
69
            else:
69
 
                pg_dir_ips= pg_dir_ips + ',' + str(ip)
 
70
                pg_dir_ips = pg_dir_ips + ',' + str(ip)
70
71
        pg_ctxt['local_ip'] = pg_dir_ips
71
72
        unit_hostname = get_unit_hostname()
72
73
        pg_ctxt['pg_hostname'] = unit_hostname