mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
fix(oci): show progress between selected updates
- Show which selected update is starting while its container is checked - Keep the single-application flow unchanged - Translate the new progress text
This commit is contained in:
@@ -854,6 +854,7 @@
|
||||
"Checking the container before modifying it...": "Container wird vor der Änderung überprüft...",
|
||||
"Checking the container before recreating it...": "Überprüfen Sie den Container, bevor Sie ihn neu erstellen ...",
|
||||
"Checking the container before the update...": "Überprüfen Sie den Container vor dem Update ...",
|
||||
"Checking the container...": "Container wird geprüft...",
|
||||
"Checking the device permissions for the application user...": "Überprüfung der Geräteberechtigungen für den Anwendungsbenutzer...",
|
||||
"Checking the image compatibility:": "Prüfung der Bildkompatibilität:",
|
||||
"Checking the image in the registry...": "Überprüfen Sie das Bild in der Registry ...",
|
||||
|
||||
@@ -853,6 +853,7 @@
|
||||
"Checking the GPU of the machine learning container...": "Comprobando la GPU del contenedor Machine learning...",
|
||||
"Checking the container before modifying it...": "Revisando el contenedor antes de modificarlo...",
|
||||
"Checking the container before the update...": "Revisando el contenedor antes de la actualización...",
|
||||
"Checking the container...": "Comprobando el contenedor...",
|
||||
"Checking the device permissions for the application user...": "Comprobando los permisos del dispositivo para el usuario de la aplicación...",
|
||||
"Checking the image compatibility:": "Comprobando la compatibilidad de la imagen:",
|
||||
"Checking the image in the registry...": "Revisando la imagen en el registro...",
|
||||
|
||||
@@ -854,6 +854,7 @@
|
||||
"Checking the container before modifying it...": "Vérification du conteneur avant de le modifier...",
|
||||
"Checking the container before recreating it...": "Vérifier le contenant avant de le recréer...",
|
||||
"Checking the container before the update...": "Vérifier le conteneur avant la mise à jour...",
|
||||
"Checking the container...": "Vérification du conteneur...",
|
||||
"Checking the device permissions for the application user...": "Vérification des autorisations de l'appareil pour l'utilisateur de l'application...",
|
||||
"Checking the image compatibility:": "Vérification de la compatibilité de l'image :",
|
||||
"Checking the image in the registry...": "Vérification de l'image dans le registre...",
|
||||
|
||||
@@ -854,6 +854,7 @@
|
||||
"Checking the container before modifying it...": "Verifica del container prima della modifica...",
|
||||
"Checking the container before recreating it...": "Verifica del container prima della ricreazione...",
|
||||
"Checking the container before the update...": "Verifica del container prima dell'aggiornamento...",
|
||||
"Checking the container...": "Verifica del container...",
|
||||
"Checking the device permissions for the application user...": "Verifica dei permessi del dispositivo per l'utente dell'applicazione...",
|
||||
"Checking the image compatibility:": "Verifica della compatibilità dell'immagine:",
|
||||
"Checking the image in the registry...": "Verifica dell'immagine nel registro...",
|
||||
|
||||
@@ -854,6 +854,7 @@
|
||||
"Checking the container before modifying it...": "Verificando o contêiner antes de modificá-lo...",
|
||||
"Checking the container before recreating it...": "Verificando o recipiente antes de recriar...",
|
||||
"Checking the container before the update...": "A verificar o contentor antes da actualização...",
|
||||
"Checking the container...": "A verificar o contentor...",
|
||||
"Checking the device permissions for the application user...": "Verificando as permissões do dispositivo para o usuário da aplicação...",
|
||||
"Checking the image compatibility:": "Verificando a compatibilidade da imagem:",
|
||||
"Checking the image in the registry...": "Verificando a imagem no registro...",
|
||||
|
||||
@@ -854,6 +854,7 @@
|
||||
"Checking the container before modifying it...": "Kontrola kontajnera pred jeho úpravou...",
|
||||
"Checking the container before recreating it...": "Kontrola kontajnera pred obnovením...",
|
||||
"Checking the container before the update...": "Kontrola kontajnera pred aktualizáciou...",
|
||||
"Checking the container...": "Kontroluje sa kontajner...",
|
||||
"Checking the device permissions for the application user...": "Kontrola oprávnení zariadenia pre užívateľa aplikácie...",
|
||||
"Checking the image compatibility:": "Kontrola kompatibility obrázku:",
|
||||
"Checking the image in the registry...": "Kontrola obrazu v registri...",
|
||||
|
||||
@@ -854,6 +854,7 @@
|
||||
"Checking the container before modifying it...": "Kontrollerar behållaren innan den ändras...",
|
||||
"Checking the container before recreating it...": "Kontrollera behållaren innan du återskapar den...",
|
||||
"Checking the container before the update...": "Kontrollera behållaren innan uppdateringen...",
|
||||
"Checking the container...": "Kontrollerar containern...",
|
||||
"Checking the device permissions for the application user...": "Kontrollera enhetens behörigheter för applikationsanvändaren...",
|
||||
"Checking the image compatibility:": "Kontrollera bildkompatibiliteten:",
|
||||
"Checking the image in the registry...": "Kolla bilden i registret...",
|
||||
|
||||
@@ -151,7 +151,7 @@ def _run_lifecycle(command, title):
|
||||
return completed.returncode == 0
|
||||
|
||||
|
||||
def carry_records(project, mount_stopped=True, vmids=None, verify=False, shown=False, heading=None):
|
||||
def carry_records(project, mount_stopped=True, vmids=None, verify=False, shown=False, heading=None, message=None):
|
||||
"""Leave inside each container the copy of its record that a restore on
|
||||
another host needs. It is refreshed after every operation. Returns what
|
||||
was found for each container. Every installed application is looked at,
|
||||
@@ -162,7 +162,7 @@ def carry_records(project, mount_stopped=True, vmids=None, verify=False, shown=F
|
||||
if heading:
|
||||
console.show_logo()
|
||||
console.msg_title(heading)
|
||||
console.msg_info(translate('Updating the copy of the record...'))
|
||||
console.msg_info(message or translate('Updating the copy of the record...'))
|
||||
try:
|
||||
import oci_carried_record
|
||||
return oci_carried_record.sync(oci_carried_record.instances.ROOT, vmids, mount_stopped, verify)
|
||||
@@ -391,13 +391,15 @@ def _toggle_watchdog(project, ui, vmid, enabled):
|
||||
return True
|
||||
|
||||
|
||||
def manage_instance(project, ui, row, action=None, lifecycle_args=()):
|
||||
def manage_instance(project, ui, row, action=None, lifecycle_args=(), heading=None):
|
||||
"""What the menu does with one instance once it is selected. `action`
|
||||
skips the choice of operation, as ProxMenux Monitor does; the extra
|
||||
`lifecycle_args` are passed to the program that performs it."""
|
||||
`lifecycle_args` are passed to the program that performs it. A `heading`
|
||||
shows the check of the container on screen, as one of several updates."""
|
||||
shown = {'shown': True, 'heading': heading, 'message': translate('Checking the container...')} if heading else {}
|
||||
# A container that came back from another node or from an older backup
|
||||
# carries the record that describes it; the one of this host is not used.
|
||||
if carry_records(project, vmids=[row['vmid']], verify=True).get(row['vmid']) == 'stale':
|
||||
if carry_records(project, vmids=[row['vmid']], verify=True, **shown).get(row['vmid']) == 'stale':
|
||||
ui.message(translate('This container was restored or came back from another host after its record on this host was written. Open this menu again to recover it; the container was not modified.'),
|
||||
translate('OCI management'))
|
||||
return False
|
||||
|
||||
@@ -188,9 +188,10 @@ def select_updates(project, ui, available):
|
||||
ui.message(translate('An application changed since the update check. Check for updates again.'),
|
||||
translate('Updates available'))
|
||||
return False
|
||||
for row in selected:
|
||||
for index, row in enumerate(selected, 1):
|
||||
# Keep the existing identity checks, backup/storage prompts, update
|
||||
# confirmation, coordinated stack update and recovery path.
|
||||
if not manage_instance(project, ui, current[row['vmid']], action='update'):
|
||||
heading = f"{translate('Update OCI')} ({index}/{len(selected)}) · {row['title']}"
|
||||
if not manage_instance(project, ui, current[row['vmid']], action='update', heading=heading):
|
||||
break # A cancellation or failure never updates later selections.
|
||||
return False
|
||||
|
||||
@@ -42,13 +42,16 @@ class SelectionTests(unittest.TestCase):
|
||||
_, ui, run = self.select(['111'])
|
||||
self.assertEqual(run.call_count, 1)
|
||||
self.assertEqual(run.call_args.args[2]['vmid'], 111)
|
||||
self.assertEqual(run.call_args.kwargs, {'action': 'update'})
|
||||
self.assertEqual(run.call_args.kwargs, {'action': 'update', 'heading': 'Update OCI (1/1) · Second app'})
|
||||
self.assertIn('Second app', ui.review.call_args.args[0])
|
||||
self.assertNotIn('First app', ui.review.call_args.args[0])
|
||||
|
||||
def test_select_all_includes_every_app_once(self):
|
||||
_, ui, run = self.select(['all', '111'])
|
||||
self.assertEqual([c.args[2]['vmid'] for c in run.call_args_list], [110, 111])
|
||||
# Each update shows its place in the batch while its container is checked.
|
||||
self.assertEqual([c.kwargs['heading'] for c in run.call_args_list],
|
||||
['Update OCI (1/2) · First app', 'Update OCI (2/2) · Second app'])
|
||||
self.assertFalse(ui.review.call_args.kwargs['default'])
|
||||
|
||||
def test_cancel_does_nothing(self):
|
||||
|
||||
Reference in New Issue
Block a user