mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 16:36:06 +00:00
refactor(vrtManager): new VM UUIDs come from uuid.uuid4()
randomUUID() built a version 4 UUID from 16 random bytes by hand; the clone and create jobs now take str(uuid4()) from the standard library, and the function and its format test go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
f97708a7b7
commit
d2383be914
4 changed files with 5 additions and 21 deletions
|
|
@ -63,14 +63,6 @@ class HostBusy(ConnectionFailed):
|
|||
(HOST_REQUESTS) still wait for its answers."""
|
||||
|
||||
|
||||
def randomUUID():
|
||||
"""Generate a random UUID."""
|
||||
u = [secrets.randbelow(256) for _ in range(16)]
|
||||
u[6] = u[6] & 15 | 4 << 4
|
||||
u[8] = u[8] & 63 | 2 << 6
|
||||
return "-".join(["%02x" * 4, "%02x" * 2, "%02x" * 2, "%02x" * 2, "%02x" * 6]) % tuple(u)
|
||||
|
||||
|
||||
def randomPasswd(length=12, alphabet=string.ascii_letters + string.digits):
|
||||
"""Generate a random password"""
|
||||
return "".join([secrets.choice(alphabet) for _ in range(length)])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue