VMware Cloud Community
Yuanye123
Enthusiast
Enthusiast
Jump to solution

The lease and cost in email are garbled

Hi everyone:

If I change the language of scenes(I use Chinese Simplified ) ,after that when I receive the email.

The lease and cost in email are garbled. So how can I solve it ?   Can only body help me ?

pastedImage_1.png

1 Solution

Accepted Solutions
jasnyder
Hot Shot
Hot Shot
Jump to solution

Sorry I didn't respond to your request on the other thread - I was working out a solution.  I assume the problem is in the formatting passed as part of the values to the template.  I think the system is trying to take the unit "Days" and localize it to Simplified Chinese, and it gets garbled.  So the best I could come up with was to pull the raw value (number) and then you add some decoration (words) to it in hte #renderRow lines below - change " --Days" to whatever makes sense.

I modified the /vcac/templates/email/html/extensions/defaults/request_catalogItem.vm file with the following.   Everything in bold red are things I changed.

#set( $nothing = '')

#set( $reqLeaseCost = $formData.get('requestLeaseCost').getCost().getAmount() )

#set( $leaseCostFormatted = $nothing.format("%.2f", $reqLeaseCost) )

#set( $rPeriod = $formData.get('requestLeasePeriod').getAmount() )

#set( $request_leasePeriod = "#valueOf('requestLeasePeriod')" )

  #if( "$!request_leasePeriod" == "" || "$!request_leasePeriod.trim()" == "" )

    #set( $requestIsQuoteProvided = $formData.get("${keyPrefix}requestIsQuoteProvided") )

    #if( "$!requestIsQuoteProvided" != "" && $requestIsQuoteProvided )

      #set( $request_leasePeriod = "#msg('notification.email.extensions.request.unlimited')" )

    #end

  #end

#if( "$!request_leasePeriod" == "#msg('notification.email.extensions.request.unlimited')" )

  #set( $rPeriod = $request_leasePeriod )

#end

<h2>#msg("notification.email.extensions.request.info") </h2>

<br/>

<table class="sectionGrid">

  #renderRow("notification.email.extensions.deployment", "#valueOf('catalogItem-Name')")

  #renderRow("notification.email.extensions.request.requestedBy", "#valueOf('requestedBy')")

  #renderRow("notification.email.extensions.request.requestDate", "#valueOf('requestedDate')")

  #renderRow("notification.email.extensions.description", "#valueOf('description')")

  #renderRow("notification.email.extensions.request.reason", "#valueOf('reasons')")

  #renderRow("notification.email.extensions.request.numberOfInstances", "#valueOf('_number_of_instances')")

  #renderRow("notification.email.extensions.request.leaseCost", "${leaseCostFormatted} -Dollars/Day")

  #renderRow("notification.email.extensions.request.leasePeriod", "${rPeriod} --Days")

  #renderRow("notification.email.extensions.request.totalCost", "#valueOf('requestTotalLeaseCost')")

</table><br/>

## Show Request Components

#set( $component_size = "#valueOf('component-ComponentNos') " )

#set( $Integer = 0 )

#if( "$!component_size" != "" && "$!component_size.trim()" != "" )

  #set( $componentSize = $Integer.parseInt($component_size.trim()) )

  #if( $componentSize != 0 )

    <h2>#msg("notification.email.extensions.component.componentInfo")</h2><br/>

    #foreach($index in [1..$componentSize] )

      ## Component general info

      #set( $curKey = "component${index}-Name" )

      #set( $component_componentName = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-Type" )

      #set( $component_componentType = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-Parent" )

      #set( $component_parentComponent = "#valueOf($curKey)" )

      ## Software specified

      #set( $curKey = "component${index}-Software-Install-Path" )

      #set( $component_installPath = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-Software-Group-License" )

      #set( $component_groupLicense = "#valueOf($curKey)" )

      ## VM specified

      #set( $curKey = "component${index}-cpu" )

      #set( $component_cpu = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-memory" )

      #set( $component_memory = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-storage" )

      #set( $component_storage = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-DestructionDate" )

      #set( $component_destructionDate = "#valueOf($curKey)" )

      <table class="sectionGrid">

          #renderRow("notification.email.extensions.component.name", "$component_componentName")

          #renderRow("notification.email.extensions.component.type", "$component_componentType")

          #renderRow("notification.email.extensions.component.parentComponent", "$component_parentComponent")

          ## Software fields

          #renderRow("notification.email.extensions.component.installPath", "$component_installPath")

          #renderRow("notification.email.extensions.component.groupLicense", "$component_groupLicense")

          ## VM fields

          #renderRow("notification.email.extensions.cpus", "$component_cpu")

          #renderRow("notification.email.extensions.memory", "$component_memory", "MB")

          #renderRow("notification.email.extensions.storage", "$component_storage", "GB")

          #renderRow("notification.email.extensions.destruction.date", "$component_destructionDate")

      </table>

      <br/>

    ##For loop

    #end

  ##end for if ($componentSize != 0)

  #end

## end for #if( "$!component_size" != "" )

#end

An example of this is below:

pastedImage_7.png

I made the text decoration conspicuous, but you could change it to a currency symbol or whatever makes sense in your locale by changing these lines:

#renderRow("notification.email.extensions.request.leaseCost", "${leaseCostFormatted} -Dollars/Day")

#renderRow("notification.email.extensions.request.leasePeriod", "${rPeriod} --Days")

View solution in original post

0 Kudos
9 Replies
jasnyder
Hot Shot
Hot Shot
Jump to solution

Sorry I didn't respond to your request on the other thread - I was working out a solution.  I assume the problem is in the formatting passed as part of the values to the template.  I think the system is trying to take the unit "Days" and localize it to Simplified Chinese, and it gets garbled.  So the best I could come up with was to pull the raw value (number) and then you add some decoration (words) to it in hte #renderRow lines below - change " --Days" to whatever makes sense.

I modified the /vcac/templates/email/html/extensions/defaults/request_catalogItem.vm file with the following.   Everything in bold red are things I changed.

#set( $nothing = '')

#set( $reqLeaseCost = $formData.get('requestLeaseCost').getCost().getAmount() )

#set( $leaseCostFormatted = $nothing.format("%.2f", $reqLeaseCost) )

#set( $rPeriod = $formData.get('requestLeasePeriod').getAmount() )

#set( $request_leasePeriod = "#valueOf('requestLeasePeriod')" )

  #if( "$!request_leasePeriod" == "" || "$!request_leasePeriod.trim()" == "" )

    #set( $requestIsQuoteProvided = $formData.get("${keyPrefix}requestIsQuoteProvided") )

    #if( "$!requestIsQuoteProvided" != "" && $requestIsQuoteProvided )

      #set( $request_leasePeriod = "#msg('notification.email.extensions.request.unlimited')" )

    #end

  #end

#if( "$!request_leasePeriod" == "#msg('notification.email.extensions.request.unlimited')" )

  #set( $rPeriod = $request_leasePeriod )

#end

<h2>#msg("notification.email.extensions.request.info") </h2>

<br/>

<table class="sectionGrid">

  #renderRow("notification.email.extensions.deployment", "#valueOf('catalogItem-Name')")

  #renderRow("notification.email.extensions.request.requestedBy", "#valueOf('requestedBy')")

  #renderRow("notification.email.extensions.request.requestDate", "#valueOf('requestedDate')")

  #renderRow("notification.email.extensions.description", "#valueOf('description')")

  #renderRow("notification.email.extensions.request.reason", "#valueOf('reasons')")

  #renderRow("notification.email.extensions.request.numberOfInstances", "#valueOf('_number_of_instances')")

  #renderRow("notification.email.extensions.request.leaseCost", "${leaseCostFormatted} -Dollars/Day")

  #renderRow("notification.email.extensions.request.leasePeriod", "${rPeriod} --Days")

  #renderRow("notification.email.extensions.request.totalCost", "#valueOf('requestTotalLeaseCost')")

</table><br/>

## Show Request Components

#set( $component_size = "#valueOf('component-ComponentNos') " )

#set( $Integer = 0 )

#if( "$!component_size" != "" && "$!component_size.trim()" != "" )

  #set( $componentSize = $Integer.parseInt($component_size.trim()) )

  #if( $componentSize != 0 )

    <h2>#msg("notification.email.extensions.component.componentInfo")</h2><br/>

    #foreach($index in [1..$componentSize] )

      ## Component general info

      #set( $curKey = "component${index}-Name" )

      #set( $component_componentName = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-Type" )

      #set( $component_componentType = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-Parent" )

      #set( $component_parentComponent = "#valueOf($curKey)" )

      ## Software specified

      #set( $curKey = "component${index}-Software-Install-Path" )

      #set( $component_installPath = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-Software-Group-License" )

      #set( $component_groupLicense = "#valueOf($curKey)" )

      ## VM specified

      #set( $curKey = "component${index}-cpu" )

      #set( $component_cpu = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-memory" )

      #set( $component_memory = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-storage" )

      #set( $component_storage = "#valueOf($curKey)" )

      #set( $curKey = "component${index}-DestructionDate" )

      #set( $component_destructionDate = "#valueOf($curKey)" )

      <table class="sectionGrid">

          #renderRow("notification.email.extensions.component.name", "$component_componentName")

          #renderRow("notification.email.extensions.component.type", "$component_componentType")

          #renderRow("notification.email.extensions.component.parentComponent", "$component_parentComponent")

          ## Software fields

          #renderRow("notification.email.extensions.component.installPath", "$component_installPath")

          #renderRow("notification.email.extensions.component.groupLicense", "$component_groupLicense")

          ## VM fields

          #renderRow("notification.email.extensions.cpus", "$component_cpu")

          #renderRow("notification.email.extensions.memory", "$component_memory", "MB")

          #renderRow("notification.email.extensions.storage", "$component_storage", "GB")

          #renderRow("notification.email.extensions.destruction.date", "$component_destructionDate")

      </table>

      <br/>

    ##For loop

    #end

  ##end for if ($componentSize != 0)

  #end

## end for #if( "$!component_size" != "" )

#end

An example of this is below:

pastedImage_7.png

I made the text decoration conspicuous, but you could change it to a currency symbol or whatever makes sense in your locale by changing these lines:

#renderRow("notification.email.extensions.request.leaseCost", "${leaseCostFormatted} -Dollars/Day")

#renderRow("notification.email.extensions.request.leasePeriod", "${rPeriod} --Days")

0 Kudos
Yuanye123
Enthusiast
Enthusiast
Jump to solution

Hi jasnyder:

Thank you very much .

My vra version is 7.2.  In my vra, I did not find /vcac/templates/email/html/extensions/defaults/request_catalogItem.vm file.

I  check the reference of  email configuration in vra of vMware .I just found the reqest_generalInfo.vm file like  request_catalogItem.vm. You can see the picture below.

Then I followed your steps ,changed the reqest_generalInfo.vm , but it did not work.

Above the picture is the content of reqest_generalInfo.vm file(not changed).

## General request info

#if( !$resourceAction || "$!resourceAction" == "" )

  #set( $request_leasePeriod = "#valueOf('requestLeasePeriod')" )

  #if( "$!request_leasePeriod" == "" || "$!request_leasePeriod.trim()" == "" ) 

    #set( $requestIsQuoteProvided = $formData.get("${keyPrefix}requestIsQuoteProvided") )

    #if( "$!requestIsQuoteProvided" != "" && $requestIsQuoteProvided ) 

      #set( $request_leasePeriod = "#msg('notification.email.extensions.request.unlimited')" )

    #end

  #end

#end

<h2>#msg("notification.email.extensions.request.info") </h2>

<br/>

##This is special case handling for scale-out/In emails, they have different template than regualar action emails.

#if( $resourceAction == "{com.vmware.csp.component.cafe.composition@resource.action.deployment.scaleout.name}")

    #parse( 'extensions/request_scaleOutAction.vm' )

#end

#if( $resourceAction == "{com.vmware.csp.component.cafe.composition@resource.action.deployment.scalein.name}")

    #parse( 'extensions/request_scaleInAction.vm' )

#end

<table class="sectionGrid">

  #renderRow("notification.email.extensions.deployment", "#valueOf('catalogItem-Name')")

  #renderRow("notification.email.extensions.action", $resourceAction_Name)

  #renderRow("notification.email.extensions.request.requestedBy", "#valueOf('requestedBy')")

  #renderRow("notification.email.extensions.request.requestDate", "#valueOf('requestedDate')")

  #renderRow("notification.email.extensions.description", "#valueOf('description')")

  #renderRow("notification.email.extensions.request.reason", "#valueOf('reasons')")

  #renderRow("notification.email.extensions.request.numberOfInstances", "#valueOf('_number_of_instances')")

pastedImage_0.png

0 Kudos
jasnyder
Hot Shot
Hot Shot
Jump to solution

From your screenshot it looks like you're looking in /usr/lib/vcac/server/webapps/notification-service/WEB-INF/classes/templates/email/html/extensions

When I check my environment (also vRA 7.2) the request_catalogItem.vm is also not there.

I was editing it in /vcac/templates/email/html/extensions/defaults which is where the templates from the e-mail customization package get expanded into.  If you can't find it there, is it because they got moved into the /vcac/templates/email/html/extensions/defaults/zh/CN folder?  I did not apply any localization to my installation, but there is a note in the article that if you want to localize them you need to move a number of the .vm files (one of which is request_catalogItem.vm) into the /vcac/templates/email/html/extensions/defaults/zh/CN folder.  So if that hasa already been done, then likely the edit needs to be made to the /vcac/templates/email/html/extensions/defaults/zh/CN/request_catalogItem.vm file instead of where I said to make it.

0 Kudos
Yuanye123
Enthusiast
Enthusiast
Jump to solution

Hi jasnyder:

In my screenshot . I can't find /vcac under / . From your answer , I  find the reason is that I have not installed the e-mail customization package.

Then I installed the package from https://blogs.vmware.com/management/2016/09/email-customization-vra.html  which released by vMware.(The name of package is vRA_7_1.tar )

After that , I followed your steps, changed the /vcac/templates/email/html/extensions/defaults/request_catalogItem.vm. But it worked partially . I got other problems.

First of all,I did not change the status of any scene under UI web Administration-Notifacations-Scenarios .

1、When I request a virtual machine ,my role is a normal user .Then I received a emali in which the information is right .Simultaneously the approver received a email, but in this email the information of cost and lease is wrong. You can look at my screenshot under this.

2、Then the approver approved or refused the request.The user and approver received another email together .But this time all information in two emails are right.

I have not test all scenarios(like as destory vm , increase the configuration of vm and so on) ,so maybe there are problems in other scenarios.I will test them all.

pastedImage_4.png

0 Kudos
jasnyder
Hot Shot
Hot Shot
Jump to solution

Did you set the top block to look like this?

#set( $nothing = '')

#set( $reqLeaseCost = $formData.get('requestLeaseCost').getCost().getAmount() )

#set( $leaseCostFormatted = $nothing.format("%.2f", $reqLeaseCost) )

#set( $rPeriod = $formData.get('requestLeasePeriod').getAmount() )

#set( $request_leasePeriod = "#valueOf('requestLeasePeriod')" )

  #if( "$!request_leasePeriod" == "" || "$!request_leasePeriod.trim()" == "" )

    #set( $requestIsQuoteProvided = $formData.get("${keyPrefix}requestIsQuoteProvided") )

    #if( "$!requestIsQuoteProvided" != "" && $requestIsQuoteProvided )

      #set( $request_leasePeriod = "#msg('notification.email.extensions.request.unlimited')" )

    #end

  #end

#if( "$!request_leasePeriod" == "#msg('notification.email.extensions.request.unlimited')" )

  #set( $rPeriod = $request_leasePeriod )

#end

Instead of this:

#set( $request_leasePeriod = "#valueOf('requestLeasePeriod')" )

  #if( "$!request_leasePeriod" == "" || "$!request_leasePeriod.trim()" == "" )

    #set( $requestIsQuoteProvided = $formData.get("${keyPrefix}requestIsQuoteProvided") )

    #if( "$!requestIsQuoteProvided" != "" && $requestIsQuoteProvided )

      #set( $request_leasePeriod = "#msg('notification.email.extensions.request.unlimited')" )

    #end

  #end

0 Kudos
jasnyder
Hot Shot
Hot Shot
Jump to solution

Also, looking at your screen shot where it says "nu ¥" - I am guessing the value for lease cost is null.  I don't know if this is because it has no lease cost or a problem in the VTL template.

Did you add the #showData() call at the bottom of the /vcac/templates/email/html/core/defaults/main.vm file?

It should look like:

[... more text up here ...]

## Include the footer

#parse( 'core/footer.vm' )

#showData()

</body>

</html>

[... more text down here ...]

The showData() call causes all values to be displayed in a table at the bottom so you can debug what's going on.  The output of it looks like:

pastedImage_1.png

Taking a look at those values will help you know if the lease cost is null or something else.

0 Kudos
Yuanye123
Enthusiast
Enthusiast
Jump to solution

Hi jasnyder:

I did set the top block following yours.

I also add the #showData() call at the bottom of the /vcac/templates/email/html/core/defaults/main.vm file.

At the beginning,I saw "nu ¥" .I guessed the value for lease cost is null,but the values of cost and lease in showData() call is not null , and the value in user's email is right. So I am guessing if we need to change someone of  approval.vm(Because the cost and lease in approver's email is wrong.This screenshot show the difference.

And below the screenshot is all the values of showData() call.

The first screenshot is the email of user . This email can get right value.

The second screenshot is the email if approver. This email can not get right value.

I have used red to mark the lease and cost in showData() call

pastedImage_0.png

pastedImage_3.png

source-source-timezoneUTC
source-source-component1-VirtualMachine.Software2.ScriptPath/root/vrashell/newrootpasswd.sh {root密码}
source-source-component1-_archiveDays7
source-source-component1-description
source-source-component1-VirtualMachine.Network0.ProfileNameJCYW_SZ
source-source-reasons
source-source-component1-source_machine_vmsnapshot
source-source-component1-max_network_adapters-1
source-source-component1-max_per_user0
source-source-component1-platform_namevsphere
source-source-component1-os_archx86_64
source-source-component1-storage60
source-source-component1-max_volumes60
source-source-approval-ApprovalNos0
source-source-component-ComponentNos1
source-source-component1-actionFullClone
source-source-component1-provisioning_workflowEntityReference[componentId=null, classId=Infrastructure.Compute.ProvisioningWorkflow, id=CloneWorkflow, label=null]
source-source-component1-_hasChildrenfalse
source-source-component1-property_groups
source-source-component1-VirtualMachine.Software0.Namelvm
source-source-component1-VirtualMachine.Software3.NameInitialbqadminpasswd
source-source-component1-_leaseDays1
source-source-component1-_number_of_instances
source-source-component1-blueprint_type1
source-source-component1-source_machineEntityReference[componentId=null, classId=Infrastructure.Virtual.Schema, id=e5312276-d9ff-4510-bf4b-8500be3327c1, label=null]
source-source-component1-machine_prefixEntityReference[componentId=null, classId=Infrastructure.Compute.MachinePrefix, id=SZ3FSIT, label=null]
source-source-component1-LeaseCostMoneyTimeRate[cost=Money[amount=42.0,currencyCode=CNY],basis=TimeSpan[unit=DAYS,amount=1]]
source-source-provider-_leaseDays4
source-source-component1-_allocation
source-source-component1-disksMultipleLiteral[[ComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Infrastructure.Compute.Machine.MachineDisk, typeFilter=null, values=LiteralMap[values={is_clone=true, initial_location=, volumeId=0, id=1503641730136, label=Hard disk 1, custom_properties=null, userCreated=false, storage_reservation_policy=, capacity=60}]]]]
source-source-requestIsQuoteProvidedtrue
source-source-component1-guest_customization_specificationTEST6.8
source-source-component1-root密码复杂度请输入系统bqadm密码,密码复杂度必须满足: 1、必须有大写字母、小写字母、数字、特殊字符中的其中3种;2、密码长度必须在9-16位;3、特殊字符仅包括+=-@#~,.[]()!%^*$
source-source-component1-datacenter_location
source-source-description
source-source-requestTotalLeaseCostMoney[amount=168.0,currencyCode=CNY]
source-source-requestLeaseCostMoneyTimeRate[cost=Money[amount=42.0,currencyCode=CNY],basis=TimeSpan[unit=DAYS,amount=1]]
source-source-requestedBy野01 袁
source-source-component1-_cluster1
source-source-component1-nicsMultipleLiteral[[ComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Infrastructure.Compute.Machine.Nic, typeFilter=null, values=LiteralMap[values={external_address=, address=, assignment_type=Static, network_profile=null, id=0, network=null, load_balancing=}]]]]
source-source-component1-Type{com.vmware.csp.component.iaas.proxy.provider@resource.type.registration.name.Infrastructure.Virtual}
source-source-component1-VirtualMachine.Network0.Nametest
source-source-requestLeasePeriodTimeSpan[unit=DAYS,amount=4]
source-source-component1-VirtualMachine.Admin.UseGuestAgentTrue
source-source-component1-allow_storage_policiesfalse
source-source-component1-VirtualMachine.Software3.ScriptPath/root/vrashell/newbqadmpasswd.sh {bqadm密码}
source-source-component1-IsQuoteProvidedtrue
source-source-catalogItem-NameBP_3FSITCentOS6.8_MySQL
source-source-component1-platform_typevirtual
source-source-component1-bqadm密码Kapaiyuanye123
source-source-component1-VirtualMachine.Customize.WaitCompleteTrue
source-source-component1-Parent
source-source-component1-os_version
source-source-component1-source_machine_external_snapshot
source-source-component1-InterfaceType{com.vmware.csp.component.iaas.proxy.provider@catalogitem.type.registration.name.Infrastructure.Virtual}
source-source-component1-Hostnametest601
source-source-component1-source_machine_nameCentOS6.8_MySQL
source-source-component1-TotalLeaseCostMoney[amount=168.0,currencyCode=CNY]
source-source-component1-display_locationfalse
source-source-component1-os_typeLinux
source-source-component1-VMware.VirtualCenter.FolderJCYW_SZ
source-source-component1-VirtualMachine.Admin.ThinProvisionTrue
source-source-component1-VirtualMachine.Software0.ScriptPath/root/vrashell/lvm.sh
source-source-provider-CentOS6.8_MySQL_JCYW_SZComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Blueprint.Node, typeFilter=BP_3FSITCentOS68_MySQL*CentOS6.8_MySQL_JCYW_SZ, values=LiteralMap[values={Hostname=test601, cpu=4, root密码=Kapaiyuanye123, bqadm密码=Kapaiyuanye123}]]
source-source-catalogItem-Type{com.vmware.csp.component.cafe.composition@composite.blueprint.catalog.item.type.name}
workItemShellUrlhttps://sz3fsitvra.bf.cn/vcac/org/vcloud/#cafe.work.items.view%5Bid:=23085269-ebd7-4cc1-acb4-3d7f391...
source-source-component1-os_distribution
source-source-component1-reservation_policyEntityReference[componentId=null, classId=Infrastructure.Reservation.Policy.ComputeResource, id=SZ3FSITRP, label=null]
source-source-component1-memory4096
source-source-component1-VirtualMachine.Software2.NameInitialrootpasswd
source-source-component1-VirtualMachine.Software1.ScriptPath/root/vrashell/zabbixactive.sh
source-source-component1-cpu4
source-source-component1-VirtualMachine.Software1.Namezabbix
source-source-component1-security_tagsMultipleLiteral[[]]
source-source-component1-bqadm密码复杂度请输入系统bqadm密码,密码复杂度必须满足: 1、必须有大写字母、小写字母、数字、特殊字符中的其中3种;2、密码长度必须在9-16位;3、特殊字符仅包括+=-@#~,.[]()!%^*$
source-source-component1-root密码Kapaiyuanye123
source-source-requestedDateTue Nov 28 09:45:39 CST 2017
source-source-component1-NameCentOS6.8_MySQL_JCYW_SZ
source-source-component1-LeasePeriodTimeSpan[unit=DAYS,amount=4]
source-source-component1-security_groupsMultipleLiteral[[]]
source-source-requestedStatePENDING

source-source-timezoneUTCsource-source-component1-VirtualMachine.Software2.ScriptPath/root/vrashell/newrootpasswd.sh {root密码}source-source-component1-_archiveDays7source-source-component1-descriptionsource-source-component1-VirtualMachine.Network0.ProfileNameJCYW_SZsource-source-reasonssource-source-component1-source_machine_vmsnapshotsource-source-component1-max_network_adapters-1source-source-component1-max_per_user0source-source-component1-platform_namevspheresource-source-component1-os_archx86_64source-source-component1-storage60source-source-component1-max_volumes60source-source-approval-ApprovalNos0source-source-component-ComponentNos1source-source-component1-actionFullClonesource-source-component1-provisioning_workflowEntityReference[componentId=null, classId=Infrastructure.Compute.ProvisioningWorkflow, id=CloneWorkflow, label=null]source-source-component1-_hasChildrenfalsesource-source-component1-property_groupssource-source-component1-VirtualMachine.Software0.Namelvmsource-source-component1-VirtualMachine.Software3.NameInitialbqadminpasswdsource-source-component1-_leaseDays1source-source-component1-_number_of_instancessource-source-component1-blueprint_type1source-source-component1-source_machineEntityReference[componentId=null, classId=Infrastructure.Virtual.Schema, id=e5312276-d9ff-4510-bf4b-8500be3327c1, label=null]source-source-component1-machine_prefixEntityReference[componentId=null, classId=Infrastructure.Compute.MachinePrefix, id=SZ3FSIT, label=null]source-source-component1-LeaseCostMoneyTimeRate[cost=Money[amount=42.0,currencyCode=CNY],basis=TimeSpan[unit=DAYS,amount=1]]source-source-provider-_leaseDays4source-source-component1-_allocationsource-source-component1-disksMultipleLiteral[[ComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Infrastructure.Compute.Machine.MachineDisk, typeFilter=null, values=LiteralMap[values={is_clone=true, initial_location=, volumeId=0, id=1503641730136, label=Hard disk 1, custom_properties=null, userCreated=false, storage_reservation_policy=, capacity=60}]]]]source-source-requestIsQuoteProvidedtruesource-source-component1-guest_customization_specificationTEST6.8source-source-component1-root密码复杂度请输入系统bqadm密码,密码复杂度必须满足: 1、必须有大写字母、小写字母、数字、特殊字符中的其中3种;2、密码长度必须在9-16位;3、特殊字符仅包括+=-@#~,.[]()!%^*$source-source-component1-datacenter_locationsource-source-descriptionsource-source-requestTotalLeaseCostMoney[amount=168.0,currencyCode=CNY]source-source-requestLeaseCostMoneyTimeRate[cost=Money[amount=42.0,currencyCode=CNY],basis=TimeSpan[unit=DAYS,amount=1]]source-source-requestedBy野01 袁source-source-component1-_cluster1source-source-component1-nicsMultipleLiteral[[ComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Infrastructure.Compute.Machine.Nic, typeFilter=null, values=LiteralMap[values={external_address=, address=, assignment_type=Static, network_profile=null, id=0, network=null, load_balancing=}]]]]source-source-component1-Type{com.vmware.csp.component.iaas.proxy.provider@resource.type.registration.name.Infrastructure.Virtual}source-source-component1-VirtualMachine.Network0.Nametestsource-source-requestLeasePeriodTimeSpan[unit=DAYS,amount=4]source-source-component1-VirtualMachine.Admin.UseGuestAgentTruesource-source-component1-allow_storage_policiesfalsesource-source-component1-VirtualMachine.Software3.ScriptPath/root/vrashell/newbqadmpasswd.sh {bqadm密码}source-source-component1-IsQuoteProvidedtruesource-source-catalogItem-NameBP_3FSITCentOS6.8_MySQLsource-source-component1-platform_typevirtualsource-source-component1-bqadm密码Kapaiyuanye123source-source-component1-VirtualMachine.Customize.WaitCompleteTruesource-source-component1-Parentsource-source-component1-os_versionsource-source-component1-source_machine_external_snapshotsource-source-component1-InterfaceType{com.vmware.csp.component.iaas.proxy.provider@catalogitem.type.registration.name.Infrastructure.Virtual}source-source-component1-Hostnametest601source-source-component1-source_machine_nameCentOS6.8_MySQLsource-source-component1-TotalLeaseCostMoney[amount=168.0,currencyCode=CNY]source-source-component1-display_locationfalsesource-source-component1-os_typeLinuxsource-source-component1-VMware.VirtualCenter.FolderJCYW_SZsource-source-component1-VirtualMachine.Admin.ThinProvisionTruesource-source-component1-VirtualMachine.Software0.ScriptPath/root/vrashell/lvm.shsource-source-provider-CentOS6.8_MySQL_JCYW_SZComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Blueprint.Node, typeFilter=BP_3FSITCentOS68_MySQL*CentOS6.8_MySQL_JCYW_SZ, values=LiteralMap[values={Hostname=test601, cpu=4, root密码=Kapaiyuanye123, bqadm密码=Kapaiyuanye123}]]source-source-catalogItem-Type{com.vmware.csp.component.cafe.composition@composite.blueprint.catalog.item.t...}workItemShellUrlhttps://sz3fsitvra.bf.cn/vcac/org/vcloud/#cafe.work.items.view%5Bid:=23085269-ebd7-4cc1-acb4-3d7f391..., classId=Infrastructure.Reservation.Policy.ComputeResource, id=SZ3FSITRP, label=null]source-source-component1-memory4096source-source-component1-VirtualMachine.Software2.NameInitialrootpasswdsource-source-component1-VirtualMachine.Software1.ScriptPath/root/vrashell/zabbixactive.shsource-source-component1-cpu4source-source-component1-VirtualMachine.Software1.Namezabbixsource-source-component1-security_tagsMultipleLiteral[[]]source-source-component1-bqadm密码复杂度请输入系统bqadm密码,密码复杂度必须满足: 1、必须有大写字母、小写字母、数字、特殊字符中的其中3种;2、密码长度必须在9-16位;3、特殊字符仅包括+=-@#~,.[]()!%^*$source-source-component1-root密码Kapaiyuanye123source-source-requestedDateTue Nov 28 09:45:39 CST 2017source-source-component1-NameCentOS6.8_MySQL_JCYW_SZsource-source-component1-LeasePeriodTimeSpan[unit=DAYS,amount=4]source-source-component1-security_groupsMultipleLiteral[[]]source-source-requestedStatePENDING

0 Kudos
Yuanye123
Enthusiast
Enthusiast
Jump to solution

Sorry. I paste all the values above this reply .But it  mixed together.

So you can look at  the screenshot below this .

pastedImage_0.png

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

source-source-timezoneUTC
source-source-component1-VirtualMachine.Software2.ScriptPath/root/vrashell/newrootpasswd.sh {root密码}
source-source-component1-_archiveDays7
source-source-component1-description
source-source-component1-VirtualMachine.Network0.ProfileNameJCYW_SZ
source-source-reasons
source-source-component1-source_machine_vmsnapshot
source-source-component1-max_network_adapters-1
source-source-component1-max_per_user0
source-source-component1-platform_namevsphere
source-source-component1-os_archx86_64
source-source-component1-storage60
source-source-component1-max_volumes60
source-source-approval-ApprovalNos0
source-source-component-ComponentNos1
source-source-component1-actionFullClone
source-source-component1-provisioning_workflowEntityReference[componentId=null, classId=Infrastructure.Compute.ProvisioningWorkflow, id=CloneWorkflow, label=null]
source-source-component1-_hasChildrenfalse
source-source-component1-property_groups
source-source-component1-VirtualMachine.Software0.Namelvm
source-source-component1-VirtualMachine.Software3.NameInitialbqadminpasswd
source-source-component1-_leaseDays1
source-source-component1-_number_of_instances
source-source-component1-blueprint_type1
source-source-component1-source_machineEntityReference[componentId=null, classId=Infrastructure.Virtual.Schema, id=e5312276-d9ff-4510-bf4b-8500be3327c1, label=null]
source-source-component1-machine_prefixEntityReference[componentId=null, classId=Infrastructure.Compute.MachinePrefix, id=SZ3FSIT, label=null]
source-source-component1-LeaseCostMoneyTimeRate[cost=Money[amount=42.0,currencyCode=CNY],basis=TimeSpan[unit=DAYS,amount=1]]
source-source-provider-_leaseDays4
source-source-component1-_allocation
source-source-component1-disksMultipleLiteral[[ComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Infrastructure.Compute.Machine.MachineDisk, typeFilter=null, values=LiteralMap[values={is_clone=true, initial_location=, volumeId=0, id=1503641730136, label=Hard disk 1, custom_properties=null, userCreated=false, storage_reservation_policy=, capacity=60}]]]]
source-source-requestIsQuoteProvidedtrue
source-source-component1-guest_customization_specificationTEST6.8
source-source-component1-root密码复杂度请输入系统bqadm密码,密码复杂度必须满足: 1、必须有大写字母、小写字母、数字、特殊字符中的其中3种;2、密码长度必须在9-16位;3、特殊字符仅包括+=-@#~,.[]()!%^*$
source-source-component1-datacenter_location
source-source-description
source-source-requestTotalLeaseCostMoney[amount=168.0,currencyCode=CNY]
source-source-requestLeaseCostMoneyTimeRate[cost=Money[amount=42.0,currencyCode=CNY],basis=TimeSpan[unit=DAYS,amount=1]]
source-source-requestedBy野01 袁
source-source-component1-_cluster1
source-source-component1-nicsMultipleLiteral[[ComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Infrastructure.Compute.Machine.Nic, typeFilter=null, values=LiteralMap[values={external_address=, address=, assignment_type=Static, network_profile=null, id=0, network=null, load_balancing=}]]]]
source-source-component1-Type{com.vmware.csp.component.iaas.proxy.provider@resource.type.registration.name.Infrastructure.Virtual}
source-source-component1-VirtualMachine.Network0.Nametest
source-source-requestLeasePeriodTimeSpan[unit=DAYS,amount=4]
source-source-component1-VirtualMachine.Admin.UseGuestAgentTrue
source-source-component1-allow_storage_policiesfalse
source-source-component1-VirtualMachine.Software3.ScriptPath/root/vrashell/newbqadmpasswd.sh {bqadm密码}
source-source-component1-IsQuoteProvidedtrue
source-source-catalogItem-NameBP_3FSITCentOS6.8_MySQL
source-source-component1-platform_typevirtual
source-source-component1-bqadm密码Kapaiyuanye123
source-source-component1-VirtualMachine.Customize.WaitCompleteTrue
source-source-component1-Parent
source-source-component1-os_version
source-source-component1-source_machine_external_snapshot
source-source-component1-InterfaceType{com.vmware.csp.component.iaas.proxy.provider@catalogitem.type.registration.name.Infrastructure.Virtual}
source-source-component1-Hostnametest601
source-source-component1-source_machine_nameCentOS6.8_MySQL
source-source-component1-TotalLeaseCostMoney[amount=168.0,currencyCode=CNY]
source-source-component1-display_locationfalse
source-source-component1-os_typeLinux
source-source-component1-VMware.VirtualCenter.FolderJCYW_SZ
source-source-component1-VirtualMachine.Admin.ThinProvisionTrue
source-source-component1-VirtualMachine.Software0.ScriptPath/root/vrashell/lvm.sh
source-source-provider-CentOS6.8_MySQL_JCYW_SZComplexLiteral[componentTypeId=com.vmware.csp.iaas.blueprint.service, componentId=null, classId=Blueprint.Node, typeFilter=BP_3FSITCentOS68_MySQL*CentOS6.8_MySQL_JCYW_SZ, values=LiteralMap[values={Hostname=test601, cpu=4, root密码=Kapaiyuanye123, bqadm密码=Kapaiyuanye123}]]
source-source-catalogItem-Type{com.vmware.csp.component.cafe.composition@composite.blueprint.catalog.item.type.name}
workItemShellUrlhttps://sz3fsitvra.bf.cn/vcac/org/vcloud/#cafe.work.items.view%5Bid:=23085269-ebd7-4cc1-acb4-3d7f391...
source-source-component1-os_distribution
source-source-component1-reservation_policyEntityReference[componentId=null, classId=Infrastructure.Reservation.Policy.ComputeResource, id=SZ3FSITRP, label=null]
source-source-component1-memory4096
source-source-component1-VirtualMachine.Software2.NameInitialrootpasswd
source-source-component1-VirtualMachine.Software1.ScriptPath/root/vrashell/zabbixactive.sh
source-source-component1-cpu4
source-source-component1-VirtualMachine.Software1.Namezabbix
source-source-component1-security_tagsMultipleLiteral[[]]
source-source-component1-bqadm密码复杂度请输入系统bqadm密码,密码复杂度必须满足: 1、必须有大写字母、小写字母、数字、特殊字符中的其中3种;2、密码长度必须在9-16位;3、特殊字符仅包括+=-@#~,.[]()!%^*$
source-source-component1-root密码Kapaiyuanye123
source-source-requestedDateTue Nov 28 09:45:39 CST 2017
source-source-component1-NameCentOS6.8_MySQL_JCYW_SZ
source-source-component1-LeasePeriodTimeSpan[unit=DAYS,amount=4]
source-source-component1-security_groupsMultipleLiteral[[]]
source-source-requestedState

PENDING

0 Kudos
Yuanye123
Enthusiast
Enthusiast
Jump to solution

Hi jasnyder:

I check carefully all the values in showData() call. I find that the names of variable for lease and cost are "source-source-requestLeasePeriod" and  "source-source-requestTotalLeaseCost".

So I change partlialy the code you added in /vcac/templates/email/html/extensions/defaults/request_catalogItem.vm. Everything in bold red are things I changed.

The variable of keyPrefix in com.vmware.csp.core.approval.workitem.request.vm values "source-source-"

After I changed the code, it works totally in emals of user and approver. But I am confused why the information of lease and cost in user's email is right when I don't add ${keyPrefix}

Another thing is that I test other scenarios(like as destory vm , reconfigure vm and so on) .I find the lease of email in these scenarios is also garbled. I referenced to the information 

released by vMware. It says:

There are three files in the extensions folder that represent this classification –

1. For request data – displayRequest

2. For request and approval data – displayApproval

3. For resource data – displayResource

So laterly I will change other ***.vm files for other scenarios .If I get other problems ,I will ask you later.   Thank you so much !

#set( $nothing = '')

#set( $reqLeaseCost = $formData.get("${keyPrefix}requestLeaseCost").getCost().getAmount() )

#set( $leaseCostFormatted = $nothing.format("%.2f", $reqLeaseCost) )

#set( $rPeriod = $formData.get("${keyPrefix}requestLeasePeriod").getAmount() )

#set( $request_leasePeriod = "#valueOf('requestLeasePeriod')" )

  #if( "$!request_leasePeriod" == "" || "$!request_leasePeriod.trim()" == "" ) 

0 Kudos