mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-10-21 21:12:01 +00:00
feat(oci): a notification for Modify, and the documentation under the same name
This commit is contained in:
@@ -63,8 +63,8 @@ def notify(event, data):
|
||||
|
||||
@contextlib.contextmanager
|
||||
def operation(vmids, kind, application, primary=None):
|
||||
"""Mark the containers for the length of an update or a recreation and
|
||||
report how it ended. `kind` is 'update' or 'recreate'."""
|
||||
"""Mark the containers for the length of an operation and report how it
|
||||
ended. `kind` is 'update', 'modify' or 'recreate'."""
|
||||
vmids = [int(vmid) for vmid in vmids]
|
||||
data = {'app_name': str(application), 'vmid': int(primary if primary is not None else vmids[0]),
|
||||
'containers': ', '.join(f'CT {vmid}' for vmid in vmids)}
|
||||
|
||||
@@ -212,7 +212,7 @@ def modify(root, vmid, changes):
|
||||
import oci_update_current
|
||||
primary_id = (record.get('stack_member') or {}).get('primary_vmid', vmid)
|
||||
name = oci_update_current.application_name(instances.read(root, primary_id), primary_id)
|
||||
with oci_operation_notice.operation([vmid], 'recreate', name, primary_id):
|
||||
with oci_operation_notice.operation([vmid], 'modify', name, primary_id):
|
||||
_modify(root, vmid, changes)
|
||||
|
||||
|
||||
|
||||
@@ -189,7 +189,9 @@ def update(vmid, acknowledge_external_data=False, proposal=None, keep_backup=Non
|
||||
if kept:
|
||||
msg_info2(f"{translate('Keeping the settings changed in Proxmox:')} {', '.join(kept)}")
|
||||
import oci_operation_notice
|
||||
with oci_operation_notice.operation([vmid], operation, application_name(record, vmid)):
|
||||
# A single container is only recreated to apply the changes of Modify.
|
||||
kind = 'update' if operation == 'update' else 'modify'
|
||||
with oci_operation_notice.operation([vmid], kind, application_name(record, vmid)):
|
||||
transaction.apply(instances.ROOT, vmid, archive, operation, proposal=proposal,
|
||||
registry_digest=digest, acknowledge_external_data=acknowledge_external_data,
|
||||
keep_backup=file_storage)
|
||||
|
||||
Reference in New Issue
Block a user