Ubuntu 22.04 and Python 3.10 preparation 22/13322/12
authorGuillermo Calvino <guillermo.calvino@canonical.com>
Fri, 28 Apr 2023 09:51:43 +0000 (11:51 +0200)
committerMark Beierl <mark.beierl@canonical.com>
Wed, 10 May 2023 16:54:21 +0000 (12:54 -0400)
Change-Id: I57a4ee39c101bdab610a6964de58eaa2653d37a3
Signed-off-by: Guillermo Calvino <guillermo.calvino@canonical.com>
Signed-off-by: Mark Beierl <mark.beierl@canonical.com>
Dockerfile
n2vc/k8s_juju_conn.py
n2vc/libjuju.py
n2vc/loggable.py
n2vc/n2vc_juju_conn.py
n2vc/store.py
requirements-dev.txt
requirements-test.txt
requirements.in
requirements.txt
tox.ini

index c597522..27ab273 100644 (file)
@@ -21,7 +21,7 @@
 #   devops-stages/stage-build.sh
 #
 
-FROM ubuntu:20.04
+FROM ubuntu:22.04
 
 ARG APT_PROXY
 RUN if [ ! -z $APT_PROXY ] ; then \
@@ -37,7 +37,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
         python3 \
         python3-all \
         python3-dev \
-        python3-setuptools
+        python3-setuptools \
+        python3-pip \
+        tox
 
-RUN python3 -m easy_install pip==21.3.1
-RUN pip install tox==3.24.5
+ENV LC_ALL C.UTF-8
+ENV LANG C.UTF-8
index babe239..7dacfb9 100644 (file)
@@ -72,7 +72,7 @@ class K8sJujuConnector(K8sConnector):
 
         db_uri = EnvironConfig(prefixes=["OSMLCM_", "OSMMON_"]).get("database_uri")
         self._store = MotorStore(db_uri)
-        self.loading_libjuju = asyncio.Lock(loop=self.loop)
+        self.loading_libjuju = asyncio.Lock()
         self.uninstall_locks = {}
 
         self.log.debug("K8S Juju connector initialized")
@@ -509,7 +509,7 @@ class K8sJujuConnector(K8sConnector):
 
         will_not_delete = False
         if model_name not in self.uninstall_locks:
-            self.uninstall_locks[model_name] = asyncio.Lock(loop=self.loop)
+            self.uninstall_locks[model_name] = asyncio.Lock()
         delete_lock = self.uninstall_locks[model_name]
 
         while delete_lock.locked():
index 55ca859..de116f0 100644 (file)
@@ -84,7 +84,7 @@ class Libjuju:
 
         self.loop = loop or asyncio.get_event_loop()
         self.loop.set_exception_handler(self.handle_exception)
-        self.creating_model = asyncio.Lock(loop=self.loop)
+        self.creating_model = asyncio.Lock()
 
         if self.vca_connection.is_default:
             self.health_check_task = self._create_health_check_task()
index cbaa116..d129b4b 100644 (file)
@@ -131,7 +131,7 @@ class Loggable:
         coroutine_id = ""
         if include_coroutine:
             try:
-                if asyncio.Task.current_task() is not None:
+                if asyncio.current_task() is not None:
 
                     def print_cor_name(c):
                         import inspect
@@ -143,7 +143,7 @@ class Loggable:
                         except Exception:
                             pass
 
-                    coro = asyncio.Task.current_task()._coro
+                    coro = asyncio.current_task()._coro
                     coroutine_id = "coro-{} {}()".format(
                         hex(id(coro))[2:], print_cor_name(coro)
                     )
index cbca396..f799f44 100644 (file)
@@ -88,7 +88,7 @@ class N2VCJujuConnector(N2VCConnector):
 
         db_uri = EnvironConfig(prefixes=["OSMLCM_", "OSMMON_"]).get("database_uri")
         self._store = MotorStore(db_uri)
-        self.loading_libjuju = asyncio.Lock(loop=self.loop)
+        self.loading_libjuju = asyncio.Lock()
         self.delete_namespace_locks = {}
         self.log.info("N2VC juju connector initialized")
 
@@ -772,7 +772,7 @@ class N2VCJujuConnector(N2VCConnector):
         self.log.info("Deleting namespace={}".format(namespace))
         will_not_delete = False
         if namespace not in self.delete_namespace_locks:
-            self.delete_namespace_locks[namespace] = asyncio.Lock(loop=self.loop)
+            self.delete_namespace_locks[namespace] = asyncio.Lock()
         delete_lock = self.delete_namespace_locks[namespace]
 
         while delete_lock.locked():
index e9586d7..c8e5910 100644 (file)
@@ -13,7 +13,6 @@
 #     limitations under the License.
 
 import abc
-import asyncio
 import typing
 
 from motor.motor_asyncio import AsyncIOMotorClient
@@ -183,22 +182,19 @@ class DbMongoStore(Store):
 
 
 class MotorStore(Store):
-    def __init__(self, uri: str, loop=None):
+    def __init__(self, uri: str):
         """
         Constructor
 
         :param: uri: Connection string to connect to the database.
-        :param: loop: Asyncio Loop
         """
         self._client = AsyncIOMotorClient(uri)
-        self.loop = loop or asyncio.get_event_loop()
         self._secret_key = None
         self._config = EnvironConfig(prefixes=["OSMLCM_", "OSMMON_"])
         self.encryption = Encryption(
             uri=uri,
             config=self._config,
             encoding_type="utf-8",
-            loop=self.loop,
             logger_name="db",
         )
 
index dc58b6a..46fdb1f 100644 (file)
@@ -22,21 +22,25 @@ async-timeout==4.0.2
     #   aiokafka
 dataclasses==0.6
     # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
+dnspython==2.3.0
+    # via
+    #   -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
+    #   pymongo
 kafka-python==2.0.2
     # via
     #   -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
     #   aiokafka
-motor==1.3.1
+motor==3.1.2
     # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
 osm-common @ git+https://osm.etsi.org/gerrit/osm/common.git@master
     # via -r requirements-dev.in
-packaging==23.0
+packaging==23.1
     # via
     #   -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
     #   aiokafka
 pycryptodome==3.17
     # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
-pymongo==3.13.0
+pymongo==4.3.3
     # via
     #   -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
     #   motor
index 3d3325c..eb0b7af 100644 (file)
 #######################################################################################
 asynctest==0.13.0
     # via -r requirements-test.in
-certifi==2022.12.7
+certifi==2023.5.7
     # via requests
 charset-normalizer==2.1.1
     # via
     #   -r requirements-test.in
     #   requests
-coverage==7.1.0
+coverage==7.2.5
     # via -r requirements-test.in
 flake8==4.0.1
     # via -r requirements-test.in
@@ -30,19 +30,19 @@ idna==3.4
     # via requests
 mccabe==0.6.1
     # via flake8
-mock==5.0.1
+mock==5.0.2
     # via -r requirements-test.in
-nose2==0.12.0
+nose2==0.13.0
     # via -r requirements-test.in
 pycodestyle==2.8.0
     # via flake8
 pyflakes==2.4.0
     # via flake8
-requests==2.28.2
+requests==2.30.0
     # via requests-mock
 requests-mock==1.10.0
     # via -r requirements-test.in
 six==1.16.0
     # via requests-mock
-urllib3==1.26.14
+urllib3==2.0.2
     # via requests
index 661da61..dea54a4 100644 (file)
@@ -14,7 +14,7 @@
 charset-normalizer<3 # Required by aiohttp in LCM
 juju==3.0.0
 kubernetes
-motor==1.3.1
+motor
 pyasn1
 pyyaml==5.4.1
 retrying-async
index c539a67..c190a1a 100644 (file)
@@ -20,7 +20,7 @@ bcrypt==4.0.1
     # via paramiko
 cachetools==5.3.0
     # via google-auth
-certifi==2022.12.7
+certifi==2023.5.7
     # via
     #   kubernetes
     #   requests
@@ -32,9 +32,11 @@ charset-normalizer==2.1.1
     # via
     #   -r requirements.in
     #   requests
-cryptography==39.0.0
+cryptography==40.0.2
     # via paramiko
-google-auth==2.16.0
+dnspython==2.3.0
+    # via pymongo
+google-auth==2.17.3
     # via kubernetes
 idna==3.4
     # via requests
@@ -42,7 +44,7 @@ juju==3.0.0
     # via -r requirements.in
 jujubundlelib==0.5.7
     # via theblues
-kubernetes==25.3.0
+kubernetes==26.1.0
     # via
     #   -r requirements.in
     #   juju
@@ -50,9 +52,9 @@ macaroonbakery==1.3.1
     # via
     #   juju
     #   theblues
-motor==1.3.1
+motor==3.1.2
     # via -r requirements.in
-mypy-extensions==0.4.3
+mypy-extensions==1.0.0
     # via typing-inspect
 oauthlib==3.2.2
     # via requests-oauthlib
@@ -60,19 +62,19 @@ paramiko==2.12.0
     # via juju
 protobuf==3.20.3
     # via macaroonbakery
-pyasn1==0.4.8
+pyasn1==0.5.0
     # via
     #   -r requirements.in
     #   juju
     #   pyasn1-modules
     #   rsa
-pyasn1-modules==0.2.8
+pyasn1-modules==0.3.0
     # via google-auth
 pycparser==2.21
     # via cffi
 pymacaroons==0.13.0
     # via macaroonbakery
-pymongo==3.13.0
+pymongo==4.3.3
     # via motor
 pynacl==1.5.0
     # via
@@ -85,7 +87,7 @@ pyrfc3339==1.1
     #   macaroonbakery
 python-dateutil==2.8.2
     # via kubernetes
-pytz==2022.7.1
+pytz==2023.3
     # via pyrfc3339
 pyyaml==5.4.1
     # via
@@ -93,7 +95,7 @@ pyyaml==5.4.1
     #   juju
     #   jujubundlelib
     #   kubernetes
-requests==2.28.2
+requests==2.30.0
     # via
     #   kubernetes
     #   macaroonbakery
@@ -115,19 +117,19 @@ six==1.16.0
     #   python-dateutil
 theblues==0.5.2
     # via juju
-toposort==1.9
+toposort==1.10
     # via juju
-typing-extensions==4.4.0
+typing-extensions==4.5.0
     # via typing-inspect
 typing-inspect==0.8.0
     # via juju
-urllib3==1.26.14
+urllib3==2.0.2
     # via
     #   kubernetes
     #   requests
-websocket-client==1.5.0
+websocket-client==1.5.1
     # via kubernetes
-websockets==7.0
+websockets==11.0.3
     # via juju
 
 # The following packages are considered to be unsafe in a requirements file:
diff --git a/tox.ini b/tox.ini
index 08a145f..d4e8594 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -23,7 +23,7 @@ toxworkdir = /tmp/.tox
 
 [testenv]
 usedevelop = True
-basepython = python3.8
+basepython = python3.10
 setenv = VIRTUAL_ENV={envdir}
          PYTHONDONTWRITEBYTECODE = 1
 deps =  -r{toxinidir}/requirements.txt