mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-03 01:17:56 +03:00
chore: Update get_vm_config method to include force parameter from cache decorator
This commit is contained in:
parent
022b620edc
commit
708a3e22af
@ -264,20 +264,20 @@ class TestProxmoxClient(UDSTransactionTestCase):
|
||||
with self._create_test_vm() as vm:
|
||||
self.pclient.enable_vm_ha(vm.id, started=False, group=self.hagroup)
|
||||
# Ensure it's enabled
|
||||
vminfo = self.pclient.get_vm_info(vm.id)
|
||||
vminfo = self.pclient.get_vm_info(vm.id, force=True)
|
||||
self.assertEqual(vminfo.ha.group, self.hagroup)
|
||||
# Disable it
|
||||
self.pclient.disable_vm_ha(vm.id)
|
||||
vminfo = self.pclient.get_vm_info(vm.id)
|
||||
vminfo = self.pclient.get_vm_info(vm.id, force=True)
|
||||
self.assertEqual(vminfo.ha.group, '')
|
||||
|
||||
def test_set_vm_protection(self) -> None:
|
||||
with self._create_test_vm() as vm:
|
||||
self.pclient.set_vm_protection(vm.id, protection=True)
|
||||
vmconfig = self.pclient.get_vm_config(vm.id)
|
||||
vmconfig = self.pclient.get_vm_config(vm.id, force=True)
|
||||
self.assertTrue(vmconfig.protection)
|
||||
self.pclient.set_vm_protection(vm.id, protection=False)
|
||||
vmconfig = self.pclient.get_vm_config(vm.id)
|
||||
vmconfig = self.pclient.get_vm_config(vm.id, force=True)
|
||||
self.assertFalse(vmconfig.protection)
|
||||
|
||||
def test_get_guest_ip_address(self) -> None:
|
||||
|
@ -664,7 +664,8 @@ class ProxmoxClient:
|
||||
|
||||
raise exceptions.ProxmoxNotFound(f'VM {vmid} not found')
|
||||
|
||||
def get_vm_config(self, vmid: int, node: typing.Optional[str] = None) -> types.VMConfiguration:
|
||||
@cached('vmc', consts.CACHE_VM_INFO_DURATION, key_helper=caching_key_helper)
|
||||
def get_vm_config(self, vmid: int, node: typing.Optional[str] = None, **kwargs: typing.Any) -> types.VMConfiguration:
|
||||
node = node or self.get_vm_info(vmid).node
|
||||
return types.VMConfiguration.from_dict(
|
||||
self.do_get(f'nodes/{node}/qemu/{vmid}/config', node=node)['data']
|
||||
|
Loading…
Reference in New Issue
Block a user