1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Compare commits

..

No commits in common. "f6915ac51ff615aa1c4d4f0cef82273035c55dd8" and "89ca8010f4a433060c1eda8e3dfd0f38c06f2ca8" have entirely different histories.

View file

@ -1,5 +1,4 @@
import random
import secrets
import re
import string
@ -26,7 +25,7 @@ def randomMAC():
def randomUUID():
"""Generate a random UUID."""
u = [secrets.randbelow(256) for ignore in range(0, 16)]
u = [random.randint(0, 255) for ignore in range(0, 16)]
u[6] = (u[6] & 0x0F) | (4 << 4)
u[8] = (u[8] & 0x3F) | (2 << 6)
return "-".join(["%02x" * 4, "%02x" * 2, "%02x" * 2, "%02x" * 2, "%02x" * 6]) % tuple(u)
@ -34,7 +33,7 @@ def randomUUID():
def randomPasswd(length=12, alphabet=string.ascii_letters + string.digits):
"""Generate a random password"""
return "".join([secrets.choice(alphabet) for i in range(length)])
return "".join([random.choice(alphabet) for i in range(length)])
def get_max_vcpus(conn, type=None):