Ubuntu Pastebin

Paste from ubuntu at Wed, 25 Jan 2017 20:11:48 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3.5
import functools
import os
import sys
import signal
import asyncio
import aiohttp
import logging

from juju.client.connection import get_macaroons
from juju.model import Model


controller_endpoint = 'jimm.jujucharms.com:443'
model_uuid = os.environ['MODEL_UUID']
username = None
password = None
cacert = None
macaroons = get_macaroons()


async def connect_to_model(model):
    await model.connect(
        controller_endpoint,
        model_uuid,
        username,
        password,
        cacert,
        macaroons,
    )

async def main(loop):
    model = Model(loop=loop)
    await connect_to_model(model)

    await model.disconnect()
    model.loop.stop()



logging.getLogger().setLevel(logging.INFO)
loop = asyncio.get_event_loop()
loop.set_debug(False)
loop.create_task(main(loop))
loop.run_forever()
Download as text