Using the interface juju-client-observe

Hi,

As suggested to me with the snap I am working on (cloud-status), I started using the libjuju with the juju-client-observe interface.

The problem I now have, is that this interface does not seem to work in a way I expect, probably missing something but the documentation is sparse.

I added the juju-client-observe interface to the snapcraft.yaml file under plugs, next to the command like show below:

apps:
  cloud-status:
    command: cloud-status
    plugs:
      - juju-client-observe

If I then run the application I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/woutervb/snap/cloud-status/6/.local/share/juju/controllers.yaml'

If I set the JUJU_DATA environment variable like JUJU_DATA=${HOME}/.local/share/juju I get a similar error, but with the path; /home/woutervb/.local/share/juju/controllers.yaml

I also tried adding the home plug, but that made a difference. There is no need to connect is, but it has to be present. In that case the snap command works if I set the JUJU_DATA like listed above. But this feels like a hack, and would require every user to put this in the shell environment. So I am wondering what the way around this is.

I would look at the Interface section on Debugging building snaps.