Comment 1 for bug 1914767

Revision history for this message
Erik Lönroth (sssler-scania) wrote :

I tried this code too with no luck:

(venv) sssler@dcv-engineering:~/model-libjuju$ cat model.py
"""
This example shows how to reconnect to a model if you encounter an error

1. Connects to current model.
2. Attempts to get an application that doesn't exist.
3. Disconnect then reconnect.

"""
from juju import loop
from juju.model import Model

async def main():
    model = Model()
    await model.connect_current()
    # print(model.applications)
    await model.disconnect()

if __name__ == '__main__':
    loop.run(main())

(venv) sssler@dcv-engineering:~/model-libjuju$ python3 model.py
Task exception was never retrieved
future: <Task finished coro=<_Task.start.<locals>.run() done, defined at /home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/connection.py:785> exception=Exception('No facade Pinger in facades {}',)>
Traceback (most recent call last):
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/connection.py", line 787, in run
    return await self.task()
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/connection.py", line 411, in _pinger
    pinger_facade = client.PingerFacade.from_connection(self)
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/_client.py", line 65, in from_connection
    connection.facades))
Exception: No facade Pinger in facades {}
Task exception was never retrieved
future: <Task finished coro=<_Task.start.<locals>.run() done, defined at /home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/connection.py:785> exception=Exception('No facade Pinger in facades {}',)>
Traceback (most recent call last):
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/connection.py", line 787, in run
    return await self.task()
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/connection.py", line 411, in _pinger
    pinger_facade = client.PingerFacade.from_connection(self)
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/_client.py", line 65, in from_connection
    connection.facades))
Exception: No facade Pinger in facades {}
Error in watcher
Traceback (most recent call last):
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/model.py", line 849, in _all_watcher
    self.connection())
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/_client.py", line 65, in from_connection
    connection.facades))
Exception: No facade AllWatcher in facades {}
Task exception was never retrieved
future: <Task finished coro=<Model._watch.<locals>._all_watcher() done, defined at /home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/model.py:846> exception=Exception('No facade AllWatcher in facades {}',)>
Traceback (most recent call last):
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/model.py", line 849, in _all_watcher
    self.connection())
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/client/_client.py", line 65, in from_connection
    connection.facades))
Exception: No facade AllWatcher in facades {}