libjuju with jem key error

Bug #1914767 reported by Erik Lönroth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Low
Unassigned

Bug Description

I have installed libjuju:

(venv) sssler@dcv-engineering:~/model-libjuju$ pip freeze
juju==2.8.4
jujubundlelib==0.5.6
macaroonbakery==1.3.1
...

I've copied the example and modified it for our jimm/jem environment (jimm.example.com):

"""
This example:

1. Connects to current controller.
2. Creates a new model.
3. Deploys an application on the new model.
4. Disconnects from the model
5. Destroys the model

"""
import logging

from juju.controller import Controller
from juju import loop

async def main():
    controller = Controller()
    # connect to current controller with current user, per Juju CLI
    await controller.connect('jimm.example.com')
    model = await controller.add_model(
        'my-test-model',
        cloud_name='my-vsphere',
        credential_name='myusername',
        region='myregion'
    )
    await model.deploy(
        'ubuntu-0',
        application_name='ubuntu',
        series='bionic',
        channel='stable',
    )
    await model.disconnect()
    await controller.destroy_model(model.info.uuid)
    await controller.disconnect()

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)
    ws_logger = logging.getLogger('websockets.protocol')
    ws_logger.setLevel(logging.INFO)
    loop.run(main())

When running the code

$ python3 controller-test.py

....

}, {'model': {'name': 'test-slurm-cluster', 'uuid': '5eaef027-d576-4828-80df-1f4cc602c4a7', 'type': 'iaas', 'owner-tag': 'user-XMAQZ9@scania'}, 'last-connection': None}]}}
Traceback (most recent call last):
  File "controller-test.py", line 42, in <module>
    loop.run(main())
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/loop.py", line 38, in run
    raise task.exception()
  File "controller-test.py", line 20, in main
    await controller.connect('jimm.scania.com')
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/controller.py", line 147, in connect
    await self.update_endpoints()
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/controller.py", line 150, in update_endpoints
    info = await self.info()
  File "/home/sssler/model-libjuju/venv/lib/python3.6/site-packages/juju/controller.py", line 293, in info
    params = [client.Entity(tag.model(uuids["controller"]))]
KeyError: 'controller'

I'm lost here.

My client sees the controller:

$ juju controllers
Use --refresh option with this command to see the latest information.

Controller Model User Access Cloud/Region Models Nodes HA Version 1 - - 2.8.3
jimm.example.com* libjuju MYUSER@example (unknown) 33 - - 2.8.1

description: updated
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 {}

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1914767] Re: libjuju with jem key error
Download full text (3.9 KiB)

Somehow your client is connecting, an presumably doing Login(), but getting
back a list from the controller that says it doesn't have any API available
(in facades {}, should be a list of facades and what versions are
available).

On Fri, Feb 5, 2021 at 9:15 AM Erik Lönroth <email address hidden>
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-pack...

Read more...

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

Right, this prevents me from using API:s with juju at the moment as I've described in a support case in UA.

John A Meinel (jameinel)
Changed in juju:
importance: Undecided → Medium
status: New → Triaged
tags: added: jaas python-libjuju
Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This Medium-priority bug has not been updated in 60 days, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

Changed in juju:
importance: Medium → Low
tags: added: expirebugs-bot
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.