Which iterates the known units, and then pulls the application from those units.
However, in events like relation-created and relation-changed, there may be data associated with the application, and not with any units. Thus Relation.units has an empty list.
Juju itself is setting JUJU_REMOTE_APP as an environment variable during those events.
To try and distill issue 175, I believe the issue is that Relation.app is set by: /github. com/canonical/ operator/ blob/master/ ops/model. py#L642
https:/
Which iterates the known units, and then pulls the application from those units.
However, in events like relation-created and relation-changed, there may be data associated with the application, and not with any units. Thus Relation.units has an empty list.
Juju itself is setting JUJU_REMOTE_APP as an environment variable during those events.
Which should be populated on the event object: /github. com/canonical/ operator/ blob/master/ ops/main. py#L154
https:/
So I might be wrong. I was thinking about Relation.app (which has a known bug) not RelationEvent.app (which should be properly populated).
Unless it is: /github. com/canonical/ operator/ blob/master/ ops/model. py#L684
https:/
which seems to only populate RelationData[app] if *Relation.app* is set.