Skip to content

Commit

Permalink
Merge branch 'main' into backports
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmilsonRodrigues authored Dec 19, 2024
2 parents 5a9370d + 9b4e411 commit 2a63004
Show file tree
Hide file tree
Showing 74 changed files with 374 additions and 387 deletions.
6 changes: 2 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ Description:
.
#!/usr/bin/python3
.
import asyncio
import logging
import sys
.
from juju import loop
from juju.model import Model
.
.
Expand Down Expand Up @@ -107,9 +107,7 @@ Description:
ws_logger = logging.getLogger('websockets.protocol')
ws_logger.setLevel(logging.INFO)
.
# Run the deploy coroutine in an asyncio event loop, using a helper
# that abstracts loop creation and teardown.
loop.run(deploy())
asyncio.run(deploy())
.
.
if __name__ == '__main__':
Expand Down
13 changes: 0 additions & 13 deletions docs/api/juju.loop.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/api/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Public APIs
===========

It is recommended that you start with :doc:`juju.model` or :doc:`juju.controller`.
If you need helpers to manage the asyncio loop, try :doc:`juju.loop`.

.. toctree::

Expand All @@ -16,7 +15,6 @@ If you need helpers to manage the asyncio loop, try :doc:`juju.loop`.
juju.errors
juju.exceptions
juju.juju
juju.loop
juju.machine
juju.model
juju.placement
Expand Down
4 changes: 2 additions & 2 deletions examples/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"""

import asyncio
import logging

from juju import jasyncio
from juju.model import Model


Expand Down Expand Up @@ -50,4 +50,4 @@ async def main():
logging.basicConfig(level=logging.DEBUG)
ws_logger = logging.getLogger("websockets.protocol")
ws_logger.setLevel(logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/add_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"""

import asyncio
import base64
import logging
import os

import yaml

from juju import jasyncio
from juju.client import client
from juju.controller import Controller

Expand Down Expand Up @@ -58,4 +58,4 @@ async def main():
logging.basicConfig(level=logging.DEBUG)
ws_logger = logging.getLogger("websockets.protocol")
ws_logger.setLevel(logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/add_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"""

import asyncio
import logging

from juju import jasyncio
from juju.model import Model

MB = 1
Expand Down Expand Up @@ -69,4 +69,4 @@ async def main():
ws_logger = logging.getLogger("websockets.protocol")
ws_logger.setLevel(logging.INFO)

jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/add_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import uuid
from logging import getLogger

from juju import jasyncio, utils
from juju import utils
from juju.controller import Controller

LOG = getLogger(__name__)
Expand Down Expand Up @@ -65,4 +65,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
5 changes: 3 additions & 2 deletions examples/add_secrets_backend.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright 2023 Canonical Ltd.
# Licensed under the Apache V2, see LICENCE file for details.

import asyncio

import hvac

from juju import jasyncio
from juju.model import Model


Expand Down Expand Up @@ -75,4 +76,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/allwatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"""

import asyncio
import logging

from juju import jasyncio
from juju.client import client
from juju.model import Model

Expand All @@ -34,4 +34,4 @@ async def watch():
ws_logger.setLevel(logging.INFO)
# Run loop until the process is manually stopped (watch will loop
# forever).
jasyncio.run(watch())
asyncio.run(watch())
5 changes: 3 additions & 2 deletions examples/charmhub_deploy_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"""

from juju import jasyncio
import asyncio

from juju.model import Model


Expand Down Expand Up @@ -40,4 +41,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
5 changes: 3 additions & 2 deletions examples/charmhub_deploy_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"""

from juju import jasyncio
import asyncio

from juju.model import Model


Expand Down Expand Up @@ -37,4 +38,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/charmhub_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
repository for charms.
"""

import asyncio
import logging

from juju import jasyncio
from juju.model import Model

log = logging.getLogger(__name__)
Expand All @@ -33,4 +33,4 @@ async def main():

if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/charmhub_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
repository for information about a given charm.
"""

import asyncio
import logging

from juju import jasyncio
from juju.model import Model

log = logging.getLogger(__name__)
Expand All @@ -29,4 +29,4 @@ async def main():

if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"""

import asyncio
import logging

from juju import jasyncio
from juju.controller import Controller


Expand All @@ -28,4 +28,4 @@ async def main():
logging.basicConfig(level=logging.DEBUG)
ws_logger = logging.getLogger("websockets.protocol")
ws_logger.setLevel(logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"""

import asyncio
import logging

from juju import jasyncio
from juju.controller import Controller


Expand All @@ -28,4 +28,4 @@ async def main():
logging.basicConfig(level=logging.DEBUG)
ws_logger = logging.getLogger("websockets.protocol")
ws_logger.setLevel(logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"""

import asyncio
import logging

from juju import jasyncio
from juju.model import Model

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -59,4 +59,4 @@ async def main():
# logging.basicConfig(level=logging.DEBUG)
ws_logger = logging.getLogger("websockets.protocol")
ws_logger.setLevel(logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/connect_current_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
and prints the number of applications deployed to it.
"""

import asyncio
import logging

from juju import jasyncio
from juju.model import Model

log = logging.getLogger(__name__)
Expand All @@ -27,4 +27,4 @@ async def main():

if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"""

import asyncio
import logging

from juju import jasyncio
from juju.controller import Controller


Expand Down Expand Up @@ -41,4 +41,4 @@ async def main():
logging.basicConfig(level=logging.DEBUG)
ws_logger = logging.getLogger("websockets.protocol")
ws_logger.setLevel(logging.INFO)
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/credential.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2023 Canonical Ltd.
# Licensed under the Apache V2, see LICENCE file for details.

import asyncio
import sys

from juju import jasyncio
from juju.controller import Controller


Expand Down Expand Up @@ -47,4 +47,4 @@ async def main(cloud_name, credential_name):

if __name__ == "__main__":
assert len(sys.argv) > 2, "Please provide a cloud and credential name"
jasyncio.run(main(sys.argv[1], sys.argv[2]))
asyncio.run(main(sys.argv[1], sys.argv[2]))
4 changes: 2 additions & 2 deletions examples/crossmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"""

import asyncio
import tempfile
from logging import getLogger

from juju import jasyncio
from juju.controller import Controller

log = getLogger(__name__)
Expand Down Expand Up @@ -83,4 +83,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/crossmodel_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"""

import asyncio
import time
from logging import getLogger
from pathlib import Path

from juju import jasyncio
from juju.controller import Controller

log = getLogger(__name__)
Expand Down Expand Up @@ -87,4 +87,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/crossmodel_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
10. Destroys models and disconnects
"""

import asyncio
import tempfile
from logging import getLogger

from juju import jasyncio
from juju.controller import Controller

log = getLogger(__name__)
Expand Down Expand Up @@ -92,4 +92,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
4 changes: 2 additions & 2 deletions examples/crossmodel_relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"""

import asyncio
import tempfile
import time
from logging import getLogger

from juju import jasyncio
from juju.controller import Controller

log = getLogger(__name__)
Expand Down Expand Up @@ -106,4 +106,4 @@ async def main():


if __name__ == "__main__":
jasyncio.run(main())
asyncio.run(main())
Loading

0 comments on commit 2a63004

Please sign in to comment.