From: Tim Van Steenburgh Date: Tue, 18 Oct 2016 20:20:18 +0000 (-0400) Subject: Wait for entity if it doesn't exist yet X-Git-Tag: 0.1.0~67 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;ds=inline;h=01b96693ece2941d9fe28b19401aae6f909c590e;p=osm%2FN2VC.git Wait for entity if it doesn't exist yet --- diff --git a/juju/model.py b/juju/model.py index 7781d34..5fb45b6 100644 --- a/juju/model.py +++ b/juju/model.py @@ -1325,7 +1325,10 @@ class BundleHandler(object): Annotations holds the annotations as key/value pairs. """ entity_id = self.resolve(id_) - entity = self.model.state.get_entity(entity_type, entity_id) + try: + entity = self.model.state.get_entity(entity_type, entity_id) + except KeyError: + entity = await self._wait_for_new(entity_type, entity_id) return await entity.set_annotations(annotations)