mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
Keep native resource edits independent of OCI recreation checks
This commit is contained in:
@@ -14,6 +14,10 @@ CONFIG_DIR = Path('/etc/pve/lxc')
|
||||
|
||||
def changes(record, candidate, config):
|
||||
"""Return a narrow native edit, or None when the normal installer is needed."""
|
||||
if (any(key in record for key in ('stack', 'stack_member', 'native_stack_intent'))
|
||||
or record['deployment'].get('stack_managed')
|
||||
or instances.identity(config) != record['installation_id']):
|
||||
return None
|
||||
previous = transaction.with_default_healthcheck(copy.deepcopy(record))
|
||||
candidate = transaction.with_default_healthcheck(copy.deepcopy(candidate))
|
||||
old, new = previous['deployment'], candidate['deployment']
|
||||
@@ -66,6 +70,8 @@ def apply(root, record, candidate, config, parameters):
|
||||
"""The caller holds the instance lock and has checked image identity/preflight."""
|
||||
if changes(record, candidate, config) != parameters:
|
||||
raise ValueError(translate('The instance changed while it was being edited; open Modify again'))
|
||||
if transaction.external_changes(record, config):
|
||||
raise ValueError(translate('The instance changed while it was being edited; open Modify again'))
|
||||
vmid = record['vmid']
|
||||
directory = instances.location(root, vmid).parent / 'modifications' / uuid.uuid4().hex
|
||||
instances.write(directory / 'before.json', {'record': record, 'config': config.decode()})
|
||||
|
||||
Reference in New Issue
Block a user