X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fmodel.py;h=db65b7d1eca5fa1af1e0c988ba7d2cea88faedf6;hb=c8d7bcea7e1fd4b174e3be2a29e382df66e88b66;hp=b74a6c81430f7478407a15d1e97aea6095d33f7c;hpb=b89f2fff0ca59f55a5caed03d15e34884721c88b;p=osm%2FN2VC.git diff --git a/juju/model.py b/juju/model.py index b74a6c8..db65b7d 100644 --- a/juju/model.py +++ b/juju/model.py @@ -159,14 +159,12 @@ class ModelState(object): def get_entity( self, entity_type, entity_id, history_index=-1, connected=True): - """Return an object instance representing the entity created or - updated by ``delta`` + """Return an object instance for the given entity_type and id. + + By default the object state matches the most recent state from + Juju. To get an instance of the object in an older state, pass + history_index, an index into the history deque for the entity. - """ - """ - log.debug( - 'Getting %s:%s at index %s', - entity_type, entity_id, history_index) """ if history_index < 0 and history_index != -1: @@ -567,7 +565,7 @@ class Model(object): This coroutine blocks until the new object appears in the model. """ - return await self._wait(entity_type, entity_id, predicate) + return await self._wait(entity_type, entity_id, 'add', predicate) async def wait_for_action(self, action_id): """Given an action, wait for it to complete.""" @@ -578,7 +576,7 @@ class Model(object): action_id = action_id[7:] def predicate(delta): - return delta.data['status'] in ('completed', 'error') + return delta.data['status'] in ('completed', 'failed') return await self._wait('action', action_id, 'change', predicate)