Skip to content

Commit 4000fd0

Browse files
UI: fix userdataid or userdata content is passed when userdata append/override is unchecked (#7758)
1 parent bde80f1 commit 4000fd0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ui/src/views/compute/DeployVM.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,8 @@ export default {
19691969
deployVmData.dynamicscalingenabled = values.dynamicscalingenabled
19701970
deployVmData.iothreadsenabled = values.iothreadsenabled
19711971
deployVmData.iodriverpolicy = values.iodriverpolicy
1972-
if (values.userdata && values.userdata.length > 0) {
1972+
const isUserdataAllowed = !this.userdataDefaultOverridePolicy || (this.userdataDefaultOverridePolicy === 'ALLOWOVERRIDE' && this.doUserdataOverride) || (this.userdataDefaultOverridePolicy === 'APPEND' && this.doUserdataAppend)
1973+
if (isUserdataAllowed && values.userdata && values.userdata.length > 0) {
19731974
deployVmData.userdata = this.$toBase64AndURIEncoded(values.userdata)
19741975
}
19751976
// step 2: select template/iso
@@ -2092,7 +2093,9 @@ export default {
20922093
}
20932094
// step 7: select ssh key pair
20942095
deployVmData.keypairs = this.sshKeyPairs.join(',')
2095-
deployVmData.userdataid = values.userdataid
2096+
if (isUserdataAllowed) {
2097+
deployVmData.userdataid = values.userdataid
2098+
}
20962099
20972100
if (values.name) {
20982101
deployVmData.name = values.name
@@ -2128,7 +2131,7 @@ export default {
21282131
idx++
21292132
}
21302133
}
2131-
if (this.userDataValues) {
2134+
if (isUserdataAllowed && this.userDataValues) {
21322135
for (const [key, value] of Object.entries(this.userDataValues)) {
21332136
deployVmData['userdatadetails[' + idx + '].' + `${key}`] = value
21342137
idx++

0 commit comments

Comments
 (0)