X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=modules%2Flibjuju%2Fexamples%2Fdeploy.py;fp=modules%2Flibjuju%2Fexamples%2Fdeploy.py;h=0000000000000000000000000000000000000000;hp=43764d7f690db735c9a09c35237bd14ce5037f8a;hb=5aa242fe2d61c2da9fdb29ed65029f3e27b6966d;hpb=e2051cca7dac12aa09f6ed33555dcc4548c4b52b diff --git a/modules/libjuju/examples/deploy.py b/modules/libjuju/examples/deploy.py deleted file mode 100644 index 43764d7..0000000 --- a/modules/libjuju/examples/deploy.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -This example: - -1. Connects to the current model -2. Deploy a charm and waits until it reports itself active -3. Destroys the unit and application - -""" -from juju import loop -from juju.model import Model - - -async def main(): - model = Model() - print('Connecting to model') - # connect to current model with current user, per Juju CLI - await model.connect() - - try: - print('Deploying ubuntu') - application = await model.deploy( - 'ubuntu-10', - application_name='ubuntu', - series='trusty', - channel='stable', - ) - - print('Waiting for active') - await model.block_until( - lambda: all(unit.workload_status == 'active' - for unit in application.units)) - - print('Removing ubuntu') - await application.remove() - finally: - print('Disconnecting from model') - await model.disconnect() - - -if __name__ == '__main__': - loop.run(main())