UI: fix userdataid or userdata content is passed when userdata append/override is unchecked (#7758)

This commit is contained in:
Wei Zhou 2023-07-25 16:01:53 +08:00 committed by GitHub
parent bde80f14aa
commit 4000fd09f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -1969,7 +1969,8 @@ export default {
deployVmData.dynamicscalingenabled = values.dynamicscalingenabled
deployVmData.iothreadsenabled = values.iothreadsenabled
deployVmData.iodriverpolicy = values.iodriverpolicy
if (values.userdata && values.userdata.length > 0) {
const isUserdataAllowed = !this.userdataDefaultOverridePolicy || (this.userdataDefaultOverridePolicy === 'ALLOWOVERRIDE' && this.doUserdataOverride) || (this.userdataDefaultOverridePolicy === 'APPEND' && this.doUserdataAppend)
if (isUserdataAllowed && values.userdata && values.userdata.length > 0) {
deployVmData.userdata = this.$toBase64AndURIEncoded(values.userdata)
}
// step 2: select template/iso
@ -2092,7 +2093,9 @@ export default {
}
// step 7: select ssh key pair
deployVmData.keypairs = this.sshKeyPairs.join(',')
deployVmData.userdataid = values.userdataid
if (isUserdataAllowed) {
deployVmData.userdataid = values.userdataid
}
if (values.name) {
deployVmData.name = values.name
@ -2128,7 +2131,7 @@ export default {
idx++
}
}
if (this.userDataValues) {
if (isUserdataAllowed && this.userDataValues) {
for (const [key, value] of Object.entries(this.userDataValues)) {
deployVmData['userdatadetails[' + idx + '].' + `${key}`] = value
idx++