コード例 #1
0
async def main():
    model = Model()
    try:
        await model.connect_current()
        print('There are {} applications'.format(len(model.applications)))
    finally:
        if model.is_connected():
            print('Disconnecting from model')
            await model.disconnect()
コード例 #2
0
async def main():
    model = Model()
    try:
        # connect to the current model with the current user, per the Juju CLI
        await model.connect()
        print('There are {} applications'.format(len(model.applications)))
    finally:
        if model.is_connected():
            print('Disconnecting from model')
            await model.disconnect()
コード例 #3
0
async def main():
    model = Model()
    try:
        # connect to the current model with the current user, per the Juju CLI
        await model.connect()
        print('There are {} applications'.format(len(model.applications)))
    finally:
        if model.is_connected():
            print('Disconnecting from model')
            await model.disconnect()
コード例 #4
0
async def main():
    model = Model()
    try:
        # connect to the current model with the current user, per the Juju CLI
        await model.connect()

        charm = await model.charmhub.info("mattermost")
        print(charm)
    finally:
        if model.is_connected():
            print('Disconnecting from model')
            await model.disconnect()
コード例 #5
0
ファイル: scp.py プロジェクト: davigar15/python-libjuju
async def main():
    model = Model()
    try:
        # connect to the current model with the current user, per the Juju CLI
        await model.connect()
        print('There are {} applications'.format(len(model.applications)))

        machine = model.machines['0']
        # This roughly expands to the following:
        # scp -i ~/.local/share/juju/ssh/juju_id_rsa -o StrictHostKeyChecking=no -q -B [email protected]:/home/ubuntu/.profile /tmp/profile
        await machine.scp_from("/home/ubuntu/.profile", "/tmp/profile")
    finally:
        if model.is_connected():
            print('Disconnecting from model')
            await model.disconnect()
コード例 #6
0
async def main():
    model = Model()
    try:
        # connect to the current model with the current user, per the Juju CLI
        await model.connect()

        # do a partial query so that we get more results.
        charms = await model.charmhub.find("kuber")

        print("Bundle\tName")
        for resp in charms.result:
            print("{}\t{}".format("N" if resp.type_ == "charm" else "Y", resp.name))
    finally:
        if model.is_connected():
            print('Disconnecting from model')
            await model.disconnect()