mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(instances): the Secure Boot machine type warning is in the user's language
A new VM with UEFI Secure Boot on a machine type other than q35 is made on q35, and the create page says so. That warning was an English-only string; it is now a translated message, with Turkish and Chinese texts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
9fa898a856
commit
a4bfe77949
6 changed files with 34 additions and 17 deletions
|
|
@ -4,7 +4,9 @@ from types import SimpleNamespace
|
|||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from computes.models import Compute
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.messages import get_messages
|
||||
from django.test import SimpleTestCase, TestCase
|
||||
from django.urls import reverse
|
||||
from instances.api.serializers import CreateInstanceSerializer
|
||||
|
|
@ -73,6 +75,14 @@ class CreateInstanceViewTests(TestCase):
|
|||
self.assertEqual((kwargs["firmware"], kwargs["machine"], kwargs["tpm_model"]),
|
||||
("UEFI Secure Boot", "q35", "tpm-crb"))
|
||||
|
||||
@patch("instances.views.wvmCreate", new=wvm_create)
|
||||
@patch("instances.views.NewVMForm")
|
||||
def test_secure_boot_on_another_machine_type_says_so_in_the_users_language(self, form_class):
|
||||
self.client.cookies[settings.LANGUAGE_COOKIE_NAME] = "tr"
|
||||
response, _ = self.create(form_class, machine="pc", firmware="UEFI Secure Boot")
|
||||
self.assertEqual([str(m) for m in get_messages(response.wsgi_request)],
|
||||
["Makine türü pc değil q35: UEFI Secure Boot bunu gerektiriyor"])
|
||||
|
||||
@patch("instances.views.wvmCreate", new=wvm_create)
|
||||
@patch("instances.views.NewVMForm")
|
||||
def test_a_firmware_or_a_tpm_the_host_does_not_offer_is_refused(self, form_class):
|
||||
|
|
@ -103,7 +113,7 @@ class CreateInstanceViewTests(TestCase):
|
|||
conn.create_volume.assert_not_called()
|
||||
conn.create_instance.assert_not_called()
|
||||
|
||||
def create(self, form_class, host=None, **data):
|
||||
def create(self, form_class, host=None, machine="q35", **data):
|
||||
"""POST the create form with data over the form's defaults; host: what
|
||||
the mocked host answers, over its defaults."""
|
||||
user = get_user_model().objects.filter(username="create-test-admin").first() or (
|
||||
|
|
@ -150,7 +160,7 @@ class CreateInstanceViewTests(TestCase):
|
|||
}
|
||||
|
||||
response = self.client.post(
|
||||
reverse("instances:create_instance", args=[compute.id, "x86_64", "q35"]),
|
||||
reverse("instances:create_instance", args=[compute.id, "x86_64", machine]),
|
||||
{"create": "1", "device0": "disk", "bus0": "virtio", "submission_key": "key-create01"},
|
||||
)
|
||||
return response, conn
|
||||
|
|
|
|||
|
|
@ -2589,11 +2589,8 @@ def create_instance(request, compute_id, arch, machine):
|
|||
messages.error(request, str(err))
|
||||
else:
|
||||
if op.params["machine"] != machine:
|
||||
messages.warning(
|
||||
request,
|
||||
"Changing machine type from '%s' to 'q35' "
|
||||
"which is required for UEFI secure boot." % machine,
|
||||
)
|
||||
messages.warning(request, _("The machine type is q35, not %(machine)s: "
|
||||
"UEFI Secure Boot needs it") % {"machine": machine})
|
||||
jobs.remember_job(request, op)
|
||||
return redirect(reverse("instances", args=[compute.id]))
|
||||
except libvirtError as lib_err:
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -11,7 +11,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-11-10 17:47+0000\n"
|
||||
"POT-Creation-Date: 2026-11-10 17:48+0000\n"
|
||||
"PO-Revision-Date: 2020-11-04 12:00+0000\n"
|
||||
"Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n"
|
||||
"Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n"
|
||||
|
|
@ -6484,19 +6484,24 @@ msgid "This host has no network for the VM: add one on its Networks page."
|
|||
msgstr ""
|
||||
"Bu sunucuda sanal makine için ağ yok: Ağlar sayfasından bir tane ekleyin."
|
||||
|
||||
#: instances/views.py:2622
|
||||
#: instances/views.py:2592
|
||||
#, python-format
|
||||
msgid "The machine type is q35, not %(machine)s: UEFI Secure Boot needs it"
|
||||
msgstr "Makine türü %(machine)s değil q35: UEFI Secure Boot bunu gerektiriyor"
|
||||
|
||||
#: instances/views.py:2619
|
||||
msgid "Flavor Created"
|
||||
msgstr "Flavor Oluşturuldu"
|
||||
|
||||
#: instances/views.py:2630
|
||||
#: instances/views.py:2627
|
||||
msgid "Create Flavor"
|
||||
msgstr "Kullanıcı Oluştur"
|
||||
|
||||
#: instances/views.py:2642
|
||||
#: instances/views.py:2639
|
||||
msgid "Flavor Deleted"
|
||||
msgstr "Flavor Silindi"
|
||||
|
||||
#: instances/views.py:2648
|
||||
#: instances/views.py:2645
|
||||
msgid "Only the size template goes; VMs made from it keep their size."
|
||||
msgstr ""
|
||||
"Yalnızca boyut şablonu silinir; ondan oluşturulan sanal makineler boyutlarını"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-11-10 17:47+0000\n"
|
||||
"POT-Creation-Date: 2026-11-10 17:48+0000\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
|
@ -6130,19 +6130,24 @@ msgstr "此主机没有可用于虚拟机磁盘的运行中存储池:请在其
|
|||
msgid "This host has no network for the VM: add one on its Networks page."
|
||||
msgstr "此主机没有可供虚拟机使用的网络:请在其“网络”页面添加一个。"
|
||||
|
||||
#: instances/views.py:2622
|
||||
#: instances/views.py:2592
|
||||
#, python-format
|
||||
msgid "The machine type is q35, not %(machine)s: UEFI Secure Boot needs it"
|
||||
msgstr "机器类型为 q35,而不是 %(machine)s:UEFI 安全启动需要它"
|
||||
|
||||
#: instances/views.py:2619
|
||||
msgid "Flavor Created"
|
||||
msgstr "规格已创建"
|
||||
|
||||
#: instances/views.py:2630
|
||||
#: instances/views.py:2627
|
||||
msgid "Create Flavor"
|
||||
msgstr "创建规格"
|
||||
|
||||
#: instances/views.py:2642
|
||||
#: instances/views.py:2639
|
||||
msgid "Flavor Deleted"
|
||||
msgstr "规格已删除"
|
||||
|
||||
#: instances/views.py:2648
|
||||
#: instances/views.py:2645
|
||||
msgid "Only the size template goes; VMs made from it keep their size."
|
||||
msgstr "仅删除此规格;由它创建的虚拟机保持其大小。"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue