This is an automated email from the ASF dual-hosted git repository.

weizhou pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.18 by this push:
     new 4000fd09f17 UI: fix userdataid or userdata content is passed when 
userdata append/override is unchecked (#7758)
4000fd09f17 is described below

commit 4000fd09f1707f1e5518b1c85ceb975d4d04622c
Author: Wei Zhou <[email protected]>
AuthorDate: Tue Jul 25 16:01:53 2023 +0800

    UI: fix userdataid or userdata content is passed when userdata 
append/override is unchecked (#7758)
---
 ui/src/views/compute/DeployVM.vue | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ui/src/views/compute/DeployVM.vue 
b/ui/src/views/compute/DeployVM.vue
index de74ab8f268..c6376969646 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -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++

Reply via email to