templates-zabbix-itguys/regen_uuids.py

30 lines
1.0 KiB
Python

import uuid
import sys
target_file = "gold_edition/template_windows_os_gold.yaml"
uuids_to_replace = [
"d37d53fdc76c42988001e33bf7e214e6", "d37d53fdc76c42988001e33bf7e214e7",
"58373569dba14f1f80da26504dfa066d", "58373569dba14f1f80da26504dfa066e",
"9d939f611d57494bbf39f52a9f9e0b90", "9d939f611d57494bbf39f52a9f9e0b91",
"8ebb2fd926ad4586b82be80c678e12d7", "8ebb2fd926ad4586b82be80c678e12d8",
"91c24a78b4f4441cb4363387dc484900", "91c24a78b4f4441cb4363387dc484901",
"5291dca6834f47e8aecc4ee75eaec725", "5291dca6834f47e8aecc4ee75eaec726",
"a67bdcd7441d4d8fbd061fb6101fb378",
"eaabeea88dee40b894ae1945956e2b55",
"2df1c89eab4142f7a587b135930837c3", "2df1c89eab4142f7a587b135930837c2"
]
with open(target_file, 'r', encoding='utf-8') as f:
content = f.read()
for u in uuids_to_replace:
new_uuid = str(uuid.uuid4()).replace('-', '')
if u in content:
print(f"Replacing {u} -> {new_uuid}")
content = content.replace(u, new_uuid)
with open(target_file, 'w', encoding='utf-8') as f:
f.write(content)
print("Done.")