~charmers/charms/trusty/midonet-api/trunk

« back to all changes in this revision

Viewing changes to hooks/services.py

  • Committer: Antoni Segura Puimedon
  • Date: 2016-02-05 15:54:42 UTC
  • Revision ID: toni@midokura.com-20160205155442-y2hvhtx66i99v07e
Don't yield None objects

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        """Generates an iterable of related ids to add to the tunnel zone."""
66
66
        for rid in hookenv.relation_ids('host'):
67
67
            for unit in hookenv.related_units(rid):
68
 
                yield hookenv.relation_get('host_uuid', unit=unit, rid=rid)
 
68
                host_uuid = hookenv.relation_get('host_uuid', unit=unit,
 
69
                                                 rid=rid)
 
70
                if host_uuid is None:
 
71
                    hookenv.log('No uuid received for a host relation.',
 
72
                                level=hookenv.WARNING)
 
73
                else:
 
74
                    yield host_uuid
69
75
 
70
76
    def _get_keystone_token(self, context):
71
77
        keystone_client = client.Client(