fix: state not update when the TPM checkbox is toggled

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 6d5139a994)
This commit is contained in:
Yi-Ya Chen
2025-02-13 10:04:32 +00:00
committed by Mergify
parent bc4bbd9a40
commit 3e4bc31a9d
+4 -12
View File
@@ -1422,22 +1422,14 @@ export default {
}
},
setTPM(tpmEnabled) {
setTPM({ tpmEnabled = false, tpmPersistentStateEnabled = false } = {}) {
if (tpmEnabled) {
set(this.spec.template.spec.domain.devices, 'tpm', {});
set(this.spec.template.spec.domain.devices, 'tpm', tpmPersistentStateEnabled ? { persistent: true } : {});
} else {
delete this.spec.template.spec.domain.devices['tpm'];
}
},
setTPMPersistentStateEnabled(tpmPersistentStateEnabled) {
if (tpmPersistentStateEnabled) {
set(this.spec.template.spec.domain.devices, 'tpm', { persistent: true });
} else {
set(this.spec.template.spec.domain.devices, 'tpm', {});
}
},
deleteSSHFromUserData(ssh = []) {
const sshAuthorizedKeys = this.getSSHFromUserData(this.userScript);
@@ -1568,11 +1560,11 @@ export default {
},
tpmEnabled(val) {
this.setTPM(val);
this.setTPM({ tpmEnabled: val, tpmPersistentStateEnabled: this.tpmPersistentStateEnabled });
},
tpmPersistentStateEnabled(val) {
this.setTPMPersistentStateEnabled(val);
this.setTPM({ tpmEnabled: this.tpmEnabled, tpmPersistentStateEnabled: val });
},
installAgent: {