~zulcss/+junk/nova-compute-test

« back to all changes in this revision

Viewing changes to hooks/proxy/compute.py

  • Committer: Chuck Short
  • Date: 2014-05-30 19:28:26 UTC
  • Revision ID: zulcss@ubuntu.com-20140530192826-j66qco6jtxz38vbb
fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
                'neutron_url': relation_get('neutron_url', **rel),
41
41
            }
42
42
 
43
 
            print ctxt
 
43
            ctxt['neutron_security_groups'] = _neutron_security_groups()
 
44
 
 
45
            ks_url = '%s://%s:%s/v2.0' % (ctxt['auth_protocol'],
 
46
                                          ctxt['keystone_host'],
 
47
                                          ctxt['auth_port'])
 
48
            ctxt['neutron_admin_auth_url'] = ks_url
44
49
 
45
50
        return ctxt
46
51
 
 
52
    def _neutron_security_groups():
 
53
        for rid in relation_ids('cloud-compute'):
 
54
            for unit in related_units(rid):
 
55
                groups = [
 
56
                    relation_get('neutron_security_groups',
 
57
                                 rid=rid, unit=unit),
 
58
                    relation_get('quantum_security_groups',
 
59
                                 rid=rid, unit=unit),
 
60
                ]
 
61
                if ('yes'  in groups or 'Yes' in groups):
 
62
                    return True
 
63
        return False
 
64
 
47
65
    def get_context(self):
48
66
        ctxt = {}
49
67
        if config('instances_path') is not None: