X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=examples%2Fcontroller.py;h=7e7f0dae3a5fdddb3392a3f72755aed1f17a1f35;hb=2cafbe27c9fa355963e1f711c55183ac92ed0caf;hp=7edf8074d222109ca4b05dee081f2109052dc50f;hpb=08abb8a798db67317c3be00a5cae616746d00472;p=osm%2FN2VC.git diff --git a/examples/controller.py b/examples/controller.py index 7edf807..7e7f0da 100644 --- a/examples/controller.py +++ b/examples/controller.py @@ -4,38 +4,32 @@ This example: 1. Connects to current controller. 2. Creates a new model. 3. Deploys an application on the new model. - -Note: 'cloudcred' format to add a model should be: -cloudcred-__ +4. Disconnects from the model +5. Destroys the model """ import asyncio import logging -from juju.model import Model, ModelObserver from juju.controller import Controller -class MyModelObserver(ModelObserver): - async def on_change(self, delta, old, new, model): - pass - - async def run(): controller = Controller() await controller.connect_current() model = await controller.add_model( - 'libjuju-test', - 'cloud-aws', - 'cloudcred-aws_tvansteenburgh_external@aws-tim', + 'my-test-model', + 'aws', + 'aws-tim', ) await model.deploy( 'ubuntu-0', - service_name='ubuntu', + application_name='ubuntu', series='trusty', channel='stable', ) await model.disconnect() + await controller.destroy_model(model.info.uuid) await controller.disconnect() model.loop.stop()