1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 11:46:49 +00:00

fix(instances): no deprecated crypt module from Python 3.11

The root password hash for a shut-off VM used crypt_r where installed
(Python 3.13) and fell back to the stdlib crypt, which Python 3.11 and
3.12 deprecate: `python -W error::DeprecationWarning manage.py check`
failed there. crypt-r (the same module, it requires Python 3.11) is now
installed from 3.11, and the module is chosen by the Python version;
3.10's crypt is not deprecated.
This commit is contained in:
catborise 2026-11-06 10:56:14 +03:00
parent c126a8cd66
commit 97e107ce14
2 changed files with 8 additions and 5 deletions

View file

@ -23,4 +23,4 @@ python-socketio==5.18.1
segno==1.6.6
websockify==0.13.0
whitenoise==6.12.0
crypt-r>=3.13.0; python_version >= "3.13"
crypt-r>=3.13.0; python_version >= "3.11"

View file

@ -1,7 +1,3 @@
try:
import crypt_r as crypt
except ImportError:
import crypt
import difflib
import functools
import hashlib
@ -11,10 +7,17 @@ import os
import re
import secrets
import socket
import sys
import subprocess
import time
from ipaddress import ip_address
# the stdlib crypt is deprecated from Python 3.11 and gone in 3.13: crypt_r is the same module
if sys.version_info >= (3, 11):
import crypt_r as crypt
else:
import crypt
from accounts.models import UserInstance, UserSSHKey
from admin.decorators import superuser_only
from appsettings.models import AppSettings