X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=examples%2Fcontroller.py;h=7bd4b03925dbf03d12c4bb825454056207ea885b;hb=6ba2856fecf224ae3fd589331e889a6587e8153b;hp=de0460c20db922e9a369ab6b1c2f244a21b1c628;hpb=6f9041acecc03eaf12a6c8e5d50d20d17a28e87f;p=osm%2FN2VC.git diff --git a/examples/controller.py b/examples/controller.py index de0460c..7bd4b03 100644 --- a/examples/controller.py +++ b/examples/controller.py @@ -4,27 +4,23 @@ 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 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', @@ -33,6 +29,7 @@ async def run(): channel='stable', ) await model.disconnect() + await controller.destroy_model(model.info.uuid) await controller.disconnect() model.loop.stop()