diff --git a/command-handler/src/commands/vm.js b/command-handler/src/commands/vm.js index e18d5c6..95d0b19 100644 --- a/command-handler/src/commands/vm.js +++ b/command-handler/src/commands/vm.js @@ -112,7 +112,7 @@ export default { hetzner.createServer({ app, body, imageID, imageName, region, serverType }); } else if (actionId.startsWith('button_create_image_libvirt')) { const { imageName, instanceType } = JSON.parse(body.actions[0].value); - libvirt.createServer({ app, body, imageName, instanceType }); + libvirt.createServer({ app, body, imageName, region, instanceType }); } else if (actionId === 'button_create_vm_hetzner') { //select the hetzner server to create before calling the create server hetzner.selectRegion({ app, body }); diff --git a/command-handler/src/util/libvirt/libvirt-server.js b/command-handler/src/util/libvirt/libvirt-server.js index 5f9d820..b9c2d3a 100644 --- a/command-handler/src/util/libvirt/libvirt-server.js +++ b/command-handler/src/util/libvirt/libvirt-server.js @@ -16,7 +16,7 @@ const delay = (ms) => { } export default { - createServer: async({ app, body, imageName }) => { + createServer: async({ app, body, imageName, region, instanceType }) => { //auto generate the name const serverName = uniqueNamesGenerator({ dictionaries: [ colors, animals ], @@ -59,7 +59,9 @@ export default { "owner": userEmail, }, "user_data": Buffer.from(configUserData(serverName)).toString('base64'), - "image": imageName + "image": imageName, + "region_name": region, + "instance_type": instanceType }, { headers: { 'Authorization': `${process.env.PROVISIONER_API_TOKEN}`, @@ -366,7 +368,7 @@ export default { const buttonsArray = []; for (const serverType of data.instances) { - data.serverType = serverType.instance_type; + data.instanceType = serverType.instance_type; buttonsArray.push({ text: serverType.instance_type, actionId: `button_select_libvirt_image_${serverType.instance_type}`, value: JSON.stringify(data) }); }; const buttons = buttonBuilder({ buttonsArray, headerText: 'Select a server', fallbackText: 'unsupported device' });