From de00cb42d091dd33ba19e9f6328e02741903010b Mon Sep 17 00:00:00 2001 From: Philip Guyton Date: Mon, 9 Oct 2023 19:23:01 +0100 Subject: [PATCH] Provisional Django 2.2 LTS update #2625 Update our Django dependency. It is generally recommended to only update Django from one LTS to the next: 2.2 LTS is our next-in-line. ## Includes - A prior overlooked migration intended to prepare for this Django update. See:GitHub #2666 #2667 - Replace deprecated multi_db with databases 'property': "RemovedInDjango31Warning: TestCase.multi_db is deprecated." Which ended up breaking one of our unit tests. And so was included in this update. N.B. there remains some Django update warnings but these are to be addressed in future dedicated issues/commits. --- poetry.lock | 46 ++++++++++++++----- pyproject.toml | 2 +- src/rockstor/smart_manager/tests/test_snmp.py | 2 +- .../tests/test_task_scheduler.py | 2 +- .../migrations/0018_auto_20231009_1827.py | 17 +++++++ .../storageadmin/tests/test_appliances.py | 1 + .../storageadmin/tests/test_shares.py | 2 +- 7 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 src/rockstor/storageadmin/migrations/0018_auto_20231009_1827.py diff --git a/poetry.lock b/poetry.lock index f6b2c6e09..704471474 100644 --- a/poetry.lock +++ b/poetry.lock @@ -46,14 +46,15 @@ python-versions = ">=3.6" [[package]] name = "django" -version = "1.11.29" +version = "2.2.28" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." category = "main" optional = false -python-versions = "*" +python-versions = ">=3.5" [package.dependencies] pytz = "*" +sqlparse = ">=0.2.2" [package.extras] argon2 = ["argon2-cffi (>=16.1.0)"] @@ -246,7 +247,7 @@ six = ">=1.9.0" [[package]] name = "pytz" -version = "2023.3" +version = "2023.3.post1" description = "World timezone definitions, modern and historical" category = "main" optional = false @@ -286,6 +287,19 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "sqlparse" +version = "0.4.4" +description = "A non-validating SQL parser." +category = "main" +optional = false +python-versions = ">=3.5" + +[package.extras] +dev = ["build", "flake8"] +doc = ["sphinx"] +test = ["pytest", "pytest-cov"] + [[package]] name = "supervisor" version = "4.2.4" @@ -299,14 +313,14 @@ testing = ["pytest", "pytest-cov"] [[package]] name = "urllib3" -version = "1.26.16" +version = "1.26.17" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] +brotli = ["brotli (==1.0.9)", "brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] @@ -346,7 +360,7 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "1.1" python-versions = ">= 3.6, < 3.9" -content-hash = "fb6e94460ce403d35e64a5408875a38149fc392847e38d36fe6962da1ed31ef6" +content-hash = "b79a39138a2a37de13ee6ab2031e542646209b10a7b73478fd43b1f2eb8ba278" [metadata.files] certifi = [ @@ -431,8 +445,8 @@ distro = [ {file = "distro-1.8.0.tar.gz", hash = "sha256:02e111d1dc6a50abb8eed6bf31c3e48ed8b0830d1ea2a1b78c61765c2513fdd8"}, ] django = [ - {file = "Django-1.11.29-py2.py3-none-any.whl", hash = "sha256:014e3392058d94f40569206a24523ce254d55ad2f9f46c6550b0fe2e4f94cf3f"}, - {file = "Django-1.11.29.tar.gz", hash = "sha256:4200aefb6678019a0acf0005cd14cfce3a5e6b9b90d06145fcdd2e474ad4329c"}, + {file = "Django-2.2.28-py3-none-any.whl", hash = "sha256:365429d07c1336eb42ba15aa79f45e1c13a0b04d5c21569e7d596696418a6a45"}, + {file = "Django-2.2.28.tar.gz", hash = "sha256:0200b657afbf1bc08003845ddda053c7641b9b24951e52acd51f6abda33a7413"}, ] django-braces = [ {file = "django-braces-1.13.0.tar.gz", hash = "sha256:ba68e98b817c6f01d71d10849f359979617b3fe4cefb7f289adefddced092ddc"}, @@ -514,6 +528,7 @@ greenlet = [ {file = "greenlet-2.0.2-cp27-cp27m-win32.whl", hash = "sha256:6c3acb79b0bfd4fe733dff8bc62695283b57949ebcca05ae5c129eb606ff2d74"}, {file = "greenlet-2.0.2-cp27-cp27m-win_amd64.whl", hash = "sha256:283737e0da3f08bd637b5ad058507e578dd462db259f7f6e4c5c365ba4ee9343"}, {file = "greenlet-2.0.2-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:d27ec7509b9c18b6d73f2f5ede2622441de812e7b1a80bbd446cb0633bd3d5ae"}, + {file = "greenlet-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d967650d3f56af314b72df7089d96cda1083a7fc2da05b375d2bc48c82ab3f3c"}, {file = "greenlet-2.0.2-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:30bcf80dda7f15ac77ba5af2b961bdd9dbc77fd4ac6105cee85b0d0a5fcf74df"}, {file = "greenlet-2.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:26fbfce90728d82bc9e6c38ea4d038cba20b7faf8a0ca53a9c07b67318d46088"}, {file = "greenlet-2.0.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9190f09060ea4debddd24665d6804b995a9c122ef5917ab26e1566dcc712ceeb"}, @@ -522,6 +537,7 @@ greenlet = [ {file = "greenlet-2.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:76ae285c8104046b3a7f06b42f29c7b73f77683df18c49ab5af7983994c2dd91"}, {file = "greenlet-2.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:2d4686f195e32d36b4d7cf2d166857dbd0ee9f3d20ae349b6bf8afc8485b3645"}, {file = "greenlet-2.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:c4302695ad8027363e96311df24ee28978162cdcdd2006476c43970b384a244c"}, + {file = "greenlet-2.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d4606a527e30548153be1a9f155f4e283d109ffba663a15856089fb55f933e47"}, {file = "greenlet-2.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c48f54ef8e05f04d6eff74b8233f6063cb1ed960243eacc474ee73a2ea8573ca"}, {file = "greenlet-2.0.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a1846f1b999e78e13837c93c778dcfc3365902cfb8d1bdb7dd73ead37059f0d0"}, {file = "greenlet-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a06ad5312349fec0ab944664b01d26f8d1f05009566339ac6f63f56589bc1a2"}, @@ -551,6 +567,7 @@ greenlet = [ {file = "greenlet-2.0.2-cp37-cp37m-win32.whl", hash = "sha256:3f6ea9bd35eb450837a3d80e77b517ea5bc56b4647f5502cd28de13675ee12f7"}, {file = "greenlet-2.0.2-cp37-cp37m-win_amd64.whl", hash = "sha256:7492e2b7bd7c9b9916388d9df23fa49d9b88ac0640db0a5b4ecc2b653bf451e3"}, {file = "greenlet-2.0.2-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:b864ba53912b6c3ab6bcb2beb19f19edd01a6bfcbdfe1f37ddd1778abfe75a30"}, + {file = "greenlet-2.0.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:1087300cf9700bbf455b1b97e24db18f2f77b55302a68272c56209d5587c12d1"}, {file = "greenlet-2.0.2-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:ba2956617f1c42598a308a84c6cf021a90ff3862eddafd20c3333d50f0edb45b"}, {file = "greenlet-2.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fc3a569657468b6f3fb60587e48356fe512c1754ca05a564f11366ac9e306526"}, {file = "greenlet-2.0.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8eab883b3b2a38cc1e050819ef06a7e6344d4a990d24d45bc6f2cf959045a45b"}, @@ -559,6 +576,7 @@ greenlet = [ {file = "greenlet-2.0.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b0ef99cdbe2b682b9ccbb964743a6aca37905fda5e0452e5ee239b1654d37f2a"}, {file = "greenlet-2.0.2-cp38-cp38-win32.whl", hash = "sha256:b80f600eddddce72320dbbc8e3784d16bd3fb7b517e82476d8da921f27d4b249"}, {file = "greenlet-2.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:4d2e11331fc0c02b6e84b0d28ece3a36e0548ee1a1ce9ddde03752d9b79bba40"}, + {file = "greenlet-2.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8512a0c38cfd4e66a858ddd1b17705587900dd760c6003998e9472b77b56d417"}, {file = "greenlet-2.0.2-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:88d9ab96491d38a5ab7c56dd7a3cc37d83336ecc564e4e8816dbed12e5aaefc8"}, {file = "greenlet-2.0.2-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:561091a7be172ab497a3527602d467e2b3fbe75f9e783d8b8ce403fa414f71a6"}, {file = "greenlet-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:971ce5e14dc5e73715755d0ca2975ac88cfdaefcaab078a284fea6cfabf866df"}, @@ -633,8 +651,8 @@ python-socketio = [ {file = "python-socketio-1.6.0.tar.gz", hash = "sha256:8b325e095b64675b00c05ca7072f4cd1a05054058feacbb8f7003ba72c60f076"}, ] pytz = [ - {file = "pytz-2023.3-py2.py3-none-any.whl", hash = "sha256:a151b3abb88eda1d4e34a9814df37de2a80e301e68ba0fd856fb9b46bfbbbffb"}, - {file = "pytz-2023.3.tar.gz", hash = "sha256:1d8ce29db189191fb55338ee6d0387d82ab59f3d00eac103412d64e0ebd0c588"}, + {file = "pytz-2023.3.post1-py2.py3-none-any.whl", hash = "sha256:ce42d816b81b68506614c11e8937d3aa9e41007ceb50bfdcb0749b921bf646c7"}, + {file = "pytz-2023.3.post1.tar.gz", hash = "sha256:7b4fddbeb94a1eba4b557da24f19fdf9db575192544270a9101d8509f9f43d7b"}, ] pyzmq = [ {file = "pyzmq-19.0.2-cp27-cp27m-macosx_10_9_intel.whl", hash = "sha256:59f1e54627483dcf61c663941d94c4af9bf4163aec334171686cdaee67974fe5"}, @@ -678,13 +696,17 @@ six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] +sqlparse = [ + {file = "sqlparse-0.4.4-py3-none-any.whl", hash = "sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3"}, + {file = "sqlparse-0.4.4.tar.gz", hash = "sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c"}, +] supervisor = [ {file = "supervisor-4.2.4-py2.py3-none-any.whl", hash = "sha256:bbae57abf74e078fe0ecc9f30068b6da41b840546e233ef1e659a12e4c875af6"}, {file = "supervisor-4.2.4.tar.gz", hash = "sha256:40dc582ce1eec631c3df79420b187a6da276bbd68a4ec0a8f1f123ea616b97a2"}, ] urllib3 = [ - {file = "urllib3-1.26.16-py2.py3-none-any.whl", hash = "sha256:8d36afa7616d8ab714608411b4a3b13e58f463aee519024578e062e141dce20f"}, - {file = "urllib3-1.26.16.tar.gz", hash = "sha256:8f135f6502756bde6b2a9b28989df5fbe87c9970cecaa69041edcce7f0589b14"}, + {file = "urllib3-1.26.17-py2.py3-none-any.whl", hash = "sha256:94a757d178c9be92ef5539b8840d48dc9cf1b2709c9d6b588232a055c524458b"}, + {file = "urllib3-1.26.17.tar.gz", hash = "sha256:24d6a242c28d29af46c3fae832c36db3bbebcc533dd1bb549172cd739c82df21"}, ] urlobject = [ {file = "URLObject-2.1.1.tar.gz", hash = "sha256:06462b6ab3968e7be99442a0ecaf20ac90fdf0c50dca49126019b7bf803b1d17"}, diff --git a/pyproject.toml b/pyproject.toml index 0e882c646..ca354736d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ generate-setup-file = false python = ">= 3.6, < 3.9" # [tool.poetry.group.django.dependencies] -django = "==1.11.29" +django = "~2.2" django-oauth-toolkit = "==1.1.2" djangorestframework = "==3.9.3" django-pipeline = "==1.7.0" # last version listed with Python 3.6 and Django 1.11 compatibility diff --git a/src/rockstor/smart_manager/tests/test_snmp.py b/src/rockstor/smart_manager/tests/test_snmp.py index c8735893c..4de694d79 100644 --- a/src/rockstor/smart_manager/tests/test_snmp.py +++ b/src/rockstor/smart_manager/tests/test_snmp.py @@ -30,7 +30,7 @@ class SNMPTests(APITestCase): - multi_db = True + databases = '__all__' # TODO Requires command to reproduce minimal fixture: # "services.json" fixture requires only the smart_manager.service model. fixtures = ["test_api.json", "services.json"] diff --git a/src/rockstor/smart_manager/tests/test_task_scheduler.py b/src/rockstor/smart_manager/tests/test_task_scheduler.py index 3ec1d9a71..8289b949f 100644 --- a/src/rockstor/smart_manager/tests/test_task_scheduler.py +++ b/src/rockstor/smart_manager/tests/test_task_scheduler.py @@ -38,7 +38,7 @@ class TaskSchedulerTests(APITestCase): # src/rockstor/storageadmin/fixtures/test_pool_scrub_balance_minimal.json # # ./bin/test -v 2 -p test_task_scheduler.py - multi_db = True + databases = '__all__' fixtures = ["scheduled_tasks.json"] BASE_URL = "/api/sm/tasks" diff --git a/src/rockstor/storageadmin/migrations/0018_auto_20231009_1827.py b/src/rockstor/storageadmin/migrations/0018_auto_20231009_1827.py new file mode 100644 index 000000000..dc17f4b3d --- /dev/null +++ b/src/rockstor/storageadmin/migrations/0018_auto_20231009_1827.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.28 on 2023-10-09 17:27 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('storageadmin', '0017_auto_20230810_1141'), + ] + + operations = [ + migrations.AlterModelOptions( + name='disk', + options={'base_manager_name': 'attached'}, + ), + ] diff --git a/src/rockstor/storageadmin/tests/test_appliances.py b/src/rockstor/storageadmin/tests/test_appliances.py index 5951f6728..84b59128f 100644 --- a/src/rockstor/storageadmin/tests/test_appliances.py +++ b/src/rockstor/storageadmin/tests/test_appliances.py @@ -32,6 +32,7 @@ class AppliancesTests(APITestMixin): fixtures = ["test_api.json", "test_appliances.json"] BASE_URL = "/api/appliances" client = APIClient() + databases = '__all__' @classmethod def setUpClass(cls): diff --git a/src/rockstor/storageadmin/tests/test_shares.py b/src/rockstor/storageadmin/tests/test_shares.py index 955e18ed1..9fbfcf32c 100644 --- a/src/rockstor/storageadmin/tests/test_shares.py +++ b/src/rockstor/storageadmin/tests/test_shares.py @@ -61,7 +61,7 @@ class ShareTests(APITestMixin): - multi_db = True + databases = '__all__' fixtures = ["test_api.json", "test_shares.json", "test_shares-services.json"] BASE_URL = "/api/shares"