detection type vm

This commit is contained in:
corenthin-lebreton 2025-12-02 20:12:52 +01:00
parent a647109cc2
commit 89c2029cbc

View File

@ -76,7 +76,11 @@ export const generateVmDefinitions = (req: TerraformApplyRequest): string => {
const gateway = "192.168.143.254";
const bridge = vm.bridge || "GUACALAN";
const isWindows = vm.model && vm.model.toLowerCase() === 'windows';
// Check if model is explicitly windows OR if template name suggests windows
const isWindows = (vm.model && vm.model.toLowerCase() === 'windows') ||
(vm.template && /w(?:in|10|11|2019|2022)/i.test(vm.template));
const modelValue = isWindows ? cfg.modelWindows : cfg.modelLinux;
buf += ` network_interfaces = [\n`;