2021-02-05 13:52:36 |
Erik Lönroth |
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. |
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 |
|