Simplify code (different method for XML attributes)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
ddf8b2e7cf
commit
8340b97a4d
@ -63,7 +63,7 @@ ForEach ($Disk in $OVFConfig.DynamicDisks) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$XMLDisk = $XML.CreateElement('Disk', $XML.DocumentElement.xmlns)
|
$XMLDisk = $XML.CreateElement('Disk', $XML.DocumentElement.xmlns)
|
||||||
$XMLDiskAttrUnits = $XML.CreateAttribute('capacityAllocationUnits', $XML.DocumentElement.ovf)
|
# $XMLDiskAttrUnits = $XML.CreateAttribute('capacityAllocationUnits', $XML.DocumentElement.ovf)
|
||||||
Switch ($Disk.UnitSize) {
|
Switch ($Disk.UnitSize) {
|
||||||
'KB' {
|
'KB' {
|
||||||
$Powers = 10
|
$Powers = 10
|
||||||
@ -85,21 +85,26 @@ ForEach ($Disk in $OVFConfig.DynamicDisks) {
|
|||||||
Continue
|
Continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$XMLDiskAttrUnits.Value = "byte * 2^$($Powers)"
|
# $XMLDiskAttrUnits.Value = "byte * 2^$($Powers)"
|
||||||
$XMLDiskAttrFormat = $XML.CreateAttribute('format', $XML.DocumentElement.ovf)
|
[void]$XMLExtraConfig.SetAttribute('capacityAllocationUnits', $NS.LookupNamespace('ovf'), "byte * 2^$($Powers)")
|
||||||
$XMLDiskAttrFormat.Value = 'http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized'
|
# $XMLDiskAttrFormat = $XML.CreateAttribute('format', $XML.DocumentElement.ovf)
|
||||||
$XMLDiskId = $XML.CreateAttribute('diskId', $XML.DocumentElement.ovf)
|
# $XMLDiskAttrFormat.Value = 'http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized'
|
||||||
$XMLDiskId.Value = "vmdisk$($DiskId)"
|
[void]$XMLExtraConfig.SetAttribute('format', $NS.LookupNamespace('ovf'), 'http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized')
|
||||||
$XMLDiskAttrCapacity = $XML.CreateAttribute('capacity', $XML.DocumentElement.ovf)
|
# $XMLDiskId = $XML.CreateAttribute('diskId', $XML.DocumentElement.ovf)
|
||||||
$XMLDiskAttrCapacity.Value = '${{vmconfig.disksize.{0}}}' -f $DiskId
|
# $XMLDiskId.Value = "vmdisk$($DiskId)"
|
||||||
$XMLDiskAttrPopulated = $XML.CreateAttribute('populatedSize', $XML.DocumentElement.ovf)
|
[void]$XMLExtraConfig.SetAttribute('diskId', $NS.LookupNamespace('ovf'), "vmdisk$($DiskId)")
|
||||||
$XMLDiskAttrPopulated.Value = 0
|
# $XMLDiskAttrCapacity = $XML.CreateAttribute('capacity', $XML.DocumentElement.ovf)
|
||||||
|
# $XMLDiskAttrCapacity.Value = '${{vmconfig.disksize.{0}}}' -f $DiskId
|
||||||
|
[void]$XMLExtraConfig.SetAttribute('capacity', $NS.LookupNamespace('ovf'), '${{vmconfig.disksize.{0}}}' -f $DiskId)
|
||||||
|
# $XMLDiskAttrPopulated = $XML.CreateAttribute('populatedSize', $XML.DocumentElement.ovf)
|
||||||
|
# $XMLDiskAttrPopulated.Value = 0
|
||||||
|
[void]$XMLExtraConfig.SetAttribute('populatedSize', $NS.LookupNamespace('ovf'), 0)
|
||||||
|
|
||||||
[void]$XMLDisk.Attributes.Append($XMLDiskAttrUnits)
|
# [void]$XMLDisk.Attributes.Append($XMLDiskAttrUnits)
|
||||||
[void]$XMLDisk.Attributes.Append($XMLDiskAttrFormat)
|
# [void]$XMLDisk.Attributes.Append($XMLDiskAttrFormat)
|
||||||
[void]$XMLDisk.Attributes.Append($XMLDiskId)
|
# [void]$XMLDisk.Attributes.Append($XMLDiskId)
|
||||||
[void]$XMLDisk.Attributes.Append($XMLDiskAttrCapacity)
|
# [void]$XMLDisk.Attributes.Append($XMLDiskAttrCapacity)
|
||||||
[void]$XMLDisk.Attributes.Append($XMLDiskAttrPopulated)
|
# [void]$XMLDisk.Attributes.Append($XMLDiskAttrPopulated)
|
||||||
|
|
||||||
[void]$XML.SelectSingleNode('//ns:DiskSection', $NS).AppendChild($XMLDisk)
|
[void]$XML.SelectSingleNode('//ns:DiskSection', $NS).AppendChild($XMLDisk)
|
||||||
|
|
||||||
@ -143,8 +148,9 @@ If ($OVFConfig.DeploymentConfigurations.Count -gt 0) {
|
|||||||
ForEach ($Configuration in $OVFConfig.DeploymentConfigurations) {
|
ForEach ($Configuration in $OVFConfig.DeploymentConfigurations) {
|
||||||
$XMLConfig = $XML.CreateElement('Configuration', $XML.DocumentElement.xmlns)
|
$XMLConfig = $XML.CreateElement('Configuration', $XML.DocumentElement.xmlns)
|
||||||
|
|
||||||
$XMLConfigAttrId = $XML.CreateAttribute('id', $XML.DocumentElement.ovf)
|
# $XMLConfigAttrId = $XML.CreateAttribute('id', $XML.DocumentElement.ovf)
|
||||||
$XMLConfigAttrId.Value = $Configuration.Id
|
# $XMLConfigAttrId.Value = $Configuration.Id
|
||||||
|
[void]$XMLExtraConfig.SetAttribute('id', $NS.LookupNamespace('ovf'), $Configuration.Id)
|
||||||
|
|
||||||
$XMLConfigLabel = $XML.CreateElement('Label', $XML.DocumentElement.xmlns)
|
$XMLConfigLabel = $XML.CreateElement('Label', $XML.DocumentElement.xmlns)
|
||||||
$XMLConfigLabel.InnerText = $Configuration.Label
|
$XMLConfigLabel.InnerText = $Configuration.Label
|
||||||
@ -152,7 +158,7 @@ If ($OVFConfig.DeploymentConfigurations.Count -gt 0) {
|
|||||||
$XMLConfigDescription = $XML.CreateElement('Description', $XML.DocumentElement.xmlns)
|
$XMLConfigDescription = $XML.CreateElement('Description', $XML.DocumentElement.xmlns)
|
||||||
$XMLConfigDescription.InnerText = $Configuration.Description
|
$XMLConfigDescription.InnerText = $Configuration.Description
|
||||||
|
|
||||||
[void]$XMLConfig.Attributes.Append($XMLConfigAttrId)
|
# [void]$XMLConfig.Attributes.Append($XMLConfigAttrId)
|
||||||
[void]$XMLConfig.AppendChild($XMLConfigLabel)
|
[void]$XMLConfig.AppendChild($XMLConfigLabel)
|
||||||
[void]$XMLConfig.AppendChild($XMLConfigDescription)
|
[void]$XMLConfig.AppendChild($XMLConfigDescription)
|
||||||
|
|
||||||
@ -187,22 +193,26 @@ If ($OVFConfig.DeploymentConfigurations.Count -gt 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$XMLAttrTransport = $XML.CreateAttribute('transport', $XML.DocumentElement.ovf)
|
# $XMLAttrTransport = $XML.CreateAttribute('transport', $XML.DocumentElement.ovf)
|
||||||
$XMLAttrTransport.Value = 'com.vmware.guestInfo'
|
# $XMLAttrTransport.Value = 'com.vmware.guestInfo'
|
||||||
[void]$XML.SelectSingleNode('//ns:VirtualHardwareSection', $NS).Attributes.Append($XMLAttrTransport)
|
# [void]$XML.SelectSingleNode('//ns:VirtualHardwareSection', $NS).Attributes.Append($XMLAttrTransport)
|
||||||
|
[void]$XML.SelectSingleNode('//ns:VirtualHardwareSection', $NS).SetAttribute('transport', $NS.LookupNamespace('ovf'), 'com.vmware.guestInfo')
|
||||||
ForEach ($ExtraConfig in $OVFConfig.AdvancedOptions) {
|
ForEach ($ExtraConfig in $OVFConfig.AdvancedOptions) {
|
||||||
$XMLExtraConfig = $XML.CreateElement('vmw:ExtraConfig', $XML.DocumentElement.vmw)
|
$XMLExtraConfig = $XML.CreateElement('vmw:ExtraConfig', $XML.DocumentElement.vmw)
|
||||||
|
|
||||||
$XMLExtraConfigAttrRequired = $XML.CreateAttribute('required', $XML.DocumentElement.ovf)
|
# $XMLExtraConfigAttrRequired = $XML.CreateAttribute('required', $XML.DocumentElement.ovf)
|
||||||
$XMLExtraConfigAttrRequired.Value = "$([boolean]$ExtraConfig.Required)".ToLower()
|
# $XMLExtraConfigAttrRequired.Value = "$([boolean]$ExtraConfig.Required)".ToLower()
|
||||||
$XMLExtraConfigAttrKey = $XML.CreateAttribute('key', $XML.DocumentElement.vmw)
|
# $XMLExtraConfigAttrKey = $XML.CreateAttribute('key', $XML.DocumentElement.vmw)
|
||||||
$XMLExtraConfigAttrKey.Value = $ExtraConfig.Key
|
# $XMLExtraConfigAttrKey.Value = $ExtraConfig.Key
|
||||||
$XMLExtraConfigAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.vmw)
|
# $XMLExtraConfigAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.vmw)
|
||||||
$XMLExtraConfigAttrValue.Value = $ExtraConfig.Value
|
# $XMLExtraConfigAttrValue.Value = $ExtraConfig.Value
|
||||||
|
|
||||||
[void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrRequired)
|
# [void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrRequired)
|
||||||
[void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrKey)
|
[void]$XMLExtraConfig.SetAttribute('required', $NS.LookupNamespace('ovf'), "$([boolean]$ExtraConfig.Required)".ToLower())
|
||||||
[void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrValue)
|
# [void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrKey)
|
||||||
|
[void]$XMLExtraConfig.SetAttribute('key', $NS.LookupNamespace('vmw'), $ExtraConfig.Key)
|
||||||
|
# [void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrValue)
|
||||||
|
[void]$XMLExtraConfig.SetAttribute('value', $NS.LookupNamespace('vmw'), $ExtraConfig.Value)
|
||||||
[void]$XML.SelectSingleNode('//ns:VirtualHardwareSection', $NS).AppendChild($XMLExtraConfig)
|
[void]$XML.SelectSingleNode('//ns:VirtualHardwareSection', $NS).AppendChild($XMLExtraConfig)
|
||||||
}
|
}
|
||||||
Write-Host "Added $($OVFConfig.AdvancedOptions.Count) 'vmw:ExtraConfig' nodes"
|
Write-Host "Added $($OVFConfig.AdvancedOptions.Count) 'vmw:ExtraConfig' nodes"
|
||||||
@ -234,15 +244,18 @@ ForEach ($Category in $OVFConfig.PropertyCategories) {
|
|||||||
ForEach ($Property in $Category.ProductProperties) {
|
ForEach ($Property in $Category.ProductProperties) {
|
||||||
$XMLProperty = $XML.CreateElement('Property', $XML.DocumentElement.xmlns)
|
$XMLProperty = $XML.CreateElement('Property', $XML.DocumentElement.xmlns)
|
||||||
|
|
||||||
$XMLPropertyAttrKey = $XML.CreateAttribute('key', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrKey = $XML.CreateAttribute('key', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrKey.Value = $Property.Key
|
# $XMLPropertyAttrKey.Value = $Property.Key
|
||||||
$XMLPropertyAttrType = $XML.CreateAttribute('type', $XML.DocumentElement.ovf)
|
$XMLProperty.SetAttribute('key', $NS.LookupNamespace('ovf'), $Property.Key)
|
||||||
|
# $XMLPropertyAttrType = $XML.CreateAttribute('type', $XML.DocumentElement.ovf)
|
||||||
Switch -regex ($Property.Type) {
|
Switch -regex ($Property.Type) {
|
||||||
'^boolean' {
|
'^boolean' {
|
||||||
$XMLPropertyAttrType.Value = 'boolean'
|
# $XMLPropertyAttrType.Value = 'boolean'
|
||||||
|
$XMLProperty.SetAttribute('type', $NS.LookupNamespace('ovf'), 'boolean')
|
||||||
}
|
}
|
||||||
'^int' {
|
'^int' {
|
||||||
$XMLPropertyAttrType.Value = 'uint16'
|
# $XMLPropertyAttrType.Value = 'uint16'
|
||||||
|
$XMLProperty.SetAttribute('type', $NS.LookupNamespace('ovf'), 'uint16')
|
||||||
$Qualifiers = @()
|
$Qualifiers = @()
|
||||||
If ($Property.Type -match '^int\((\d*)\.\.(\d*)\)') {
|
If ($Property.Type -match '^int\((\d*)\.\.(\d*)\)') {
|
||||||
If ($Matches[1]) {
|
If ($Matches[1]) {
|
||||||
@ -251,22 +264,27 @@ ForEach ($Category in $OVFConfig.PropertyCategories) {
|
|||||||
If ($Matches[2]) {
|
If ($Matches[2]) {
|
||||||
$Qualifiers += "MaxValue($($Matches[2]))"
|
$Qualifiers += "MaxValue($($Matches[2]))"
|
||||||
}
|
}
|
||||||
$XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrQualifiers.Value = $Qualifiers -join ' '
|
# $XMLPropertyAttrQualifiers.Value = $Qualifiers -join ' '
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
||||||
|
$XMLProperty.SetAttribute('qualifiers', $NS.LookupNamespace('ovf'), $Qualifiers -join ' ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'^ip' {
|
'^ip' {
|
||||||
$XMLPropertyAttrType.Value = 'string'
|
# $XMLPropertyAttrType.Value = 'string'
|
||||||
$XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.vmw)
|
$XMLProperty.SetAttribute('type', $NS.LookupNamespace('ovf'), 'string')
|
||||||
$XMLPropertyAttrQualifiers.Value = 'Ip'
|
# $XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.vmw)
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
# $XMLPropertyAttrQualifiers.Value = 'Ip'
|
||||||
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
||||||
|
$XMLProperty.SetAttribute('qualifiers', $NS.LookupNamespace('vmw'), 'Ip')
|
||||||
}
|
}
|
||||||
'^password' {
|
'^password' {
|
||||||
$XMLPropertyAttrType.Value = 'string'
|
# $XMLPropertyAttrType.Value = 'string'
|
||||||
$XMLPropertyAttrPassword = $XML.CreateAttribute('password', $XML.DocumentElement.ovf)
|
$XMLProperty.SetAttribute('type', $NS.LookupNamespace('ovf'), 'string')
|
||||||
$XMLPropertyAttrPassword.Value = 'true'
|
# $XMLPropertyAttrPassword = $XML.CreateAttribute('password', $XML.DocumentElement.ovf)
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrPassword)
|
# $XMLPropertyAttrPassword.Value = 'true'
|
||||||
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrPassword)
|
||||||
|
$XMLProperty.SetAttribute('password', $NS.LookupNamespace('ovf'), 'true')
|
||||||
|
|
||||||
$Qualifiers = @()
|
$Qualifiers = @()
|
||||||
If ($Property.Type -match '^password\((\d*)\.\.(\d*)\)') {
|
If ($Property.Type -match '^password\((\d*)\.\.(\d*)\)') {
|
||||||
@ -276,13 +294,15 @@ ForEach ($Category in $OVFConfig.PropertyCategories) {
|
|||||||
If ($Matches[2]) {
|
If ($Matches[2]) {
|
||||||
$Qualifiers += "MaxLen($($Matches[2]))"
|
$Qualifiers += "MaxLen($($Matches[2]))"
|
||||||
}
|
}
|
||||||
$XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrQualifiers.Value = $Qualifiers -join ' '
|
# $XMLPropertyAttrQualifiers.Value = $Qualifiers -join ' '
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
||||||
|
$XMLProperty.SetAttribute('qualifiers', $NS.LookupNamespace('ovf'), $Qualifiers -join ' ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'^string' {
|
'^string' {
|
||||||
$XMLPropertyAttrType.Value = 'string'
|
# $XMLPropertyAttrType.Value = 'string'
|
||||||
|
$XMLProperty.SetAttribute('type', $NS.LookupNamespace('ovf'), 'string')
|
||||||
$Qualifiers = @()
|
$Qualifiers = @()
|
||||||
If ($Property.Type -match '^string\((\d*)\.\.(\d*)\)') {
|
If ($Property.Type -match '^string\((\d*)\.\.(\d*)\)') {
|
||||||
If ($Matches[1]) {
|
If ($Matches[1]) {
|
||||||
@ -291,28 +311,33 @@ ForEach ($Category in $OVFConfig.PropertyCategories) {
|
|||||||
If ($Matches[2]) {
|
If ($Matches[2]) {
|
||||||
$Qualifiers += "MaxLen($($Matches[2]))"
|
$Qualifiers += "MaxLen($($Matches[2]))"
|
||||||
}
|
}
|
||||||
$XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrQualifiers.Value = $Qualifiers -join ' '
|
# $XMLPropertyAttrQualifiers.Value = $Qualifiers -join ' '
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
||||||
|
$XMLProperty.SetAttribute('qualifiers', $NS.LookupNamespace('ovf'), $Qualifiers -join ' ')
|
||||||
} ElseIf ($Property.Type -match '^string\[(.*)\]') {
|
} ElseIf ($Property.Type -match '^string\[(.*)\]') {
|
||||||
$XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrQualifiers = $XML.CreateAttribute('qualifiers', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrQualifiers.Value = "ValueMap{$($Matches[1] -replace '","', '", "')}"
|
# $XMLPropertyAttrQualifiers.Value = "ValueMap{$($Matches[1] -replace '","', '", "')}"
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrQualifiers)
|
||||||
|
$XMLProperty.SetAttribute('qualifiers', $NS.LookupNamespace('ovf'), "ValueMap{$($Matches[1] -replace '","', '", "')}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$XMLPropertyAttrUserConfigurable = $XML.CreateAttribute('userConfigurable', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrUserConfigurable = $XML.CreateAttribute('userConfigurable', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrUserConfigurable.Value = "$([boolean]$Property.UserConfigurable)".ToLower()
|
# $XMLPropertyAttrUserConfigurable.Value = "$([boolean]$Property.UserConfigurable)".ToLower()
|
||||||
$XMLPropertyAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.ovf)
|
$XMLProperty.SetAttribute('userConfigurable', $NS.LookupNamespace('ovf'), "$([boolean]$Property.UserConfigurable)".ToLower())
|
||||||
|
# $XMLPropertyAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.ovf)
|
||||||
If ($Property.Type -eq 'boolean') {
|
If ($Property.Type -eq 'boolean') {
|
||||||
$XMLPropertyAttrValue.Value = "$([boolean]$Property.DefaultValue)".ToLower()
|
# $XMLPropertyAttrValue.Value = "$([boolean]$Property.DefaultValue)".ToLower()
|
||||||
|
$XMLProperty.SetAttribute('value', $NS.LookupNamespace('ovf'), "$([boolean]$Property.DefaultValue)".ToLower())
|
||||||
} Else {
|
} Else {
|
||||||
$XMLPropertyAttrValue.Value = $Property.DefaultValue
|
# $XMLPropertyAttrValue.Value = $Property.DefaultValue
|
||||||
|
$XMLProperty.SetAttribute('value', $NS.LookupNamespace('ovf'), $Property.DefaultValue)
|
||||||
}
|
}
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrKey)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrKey)
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrType)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrType)
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrUserConfigurable)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrUserConfigurable)
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrValue)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrValue)
|
||||||
|
|
||||||
If ($Property.Label) {
|
If ($Property.Label) {
|
||||||
$XMLPropertyLabel = $XML.CreateElement('Label', $XML.DocumentElement.xmlns)
|
$XMLPropertyLabel = $XML.CreateElement('Label', $XML.DocumentElement.xmlns)
|
||||||
@ -326,30 +351,35 @@ ForEach ($Category in $OVFConfig.PropertyCategories) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
If (($Property.Configurations.Count -eq 1) -and ($Property.Configurations -eq '*')) {
|
If (($Property.Configurations.Count -eq 1) -and ($Property.Configurations -eq '*')) {
|
||||||
$XMLPropertyAttrConfiguration = $XML.CreateAttribute('configuration', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrConfiguration = $XML.CreateAttribute('configuration', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrConfiguration.Value = $OVFConfig.DeploymentConfigurations.Id -join ' '
|
# $XMLPropertyAttrConfiguration.Value = $OVFConfig.DeploymentConfigurations.Id -join ' '
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrConfiguration)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrConfiguration)
|
||||||
|
$XMLProperty.SetAttribute('configuration', $NS.LookupNamespace('ovf'), $OVFConfig.DeploymentConfigurations.Id -join ' ')
|
||||||
} ElseIf ($Property.Configurations.Count -gt 0) {
|
} ElseIf ($Property.Configurations.Count -gt 0) {
|
||||||
$XMLPropertyAttrConfiguration = $XML.CreateAttribute('configuration', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrConfiguration = $XML.CreateAttribute('configuration', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrConfiguration.Value = $Property.Configurations -join ' '
|
# $XMLPropertyAttrConfiguration.Value = $Property.Configurations -join ' '
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrConfiguration)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrConfiguration)
|
||||||
|
$XMLProperty.SetAttribute('configuration', $NS.LookupNamespace('ovf'), $Property.Configurations -join ' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($Property.Value.Count -eq 1) {
|
If ($Property.Value.Count -eq 1) {
|
||||||
$XMLPropertyAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.ovf)
|
# $XMLPropertyAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.ovf)
|
||||||
$XMLPropertyAttrValue.Value = $Property.Value
|
# $XMLPropertyAttrValue.Value = $Property.Value
|
||||||
[void]$XMLProperty.Attributes.Append($XMLPropertyAttrValue)
|
# [void]$XMLProperty.Attributes.Append($XMLPropertyAttrValue)
|
||||||
|
$XMLProperty.SetAttribute('value', $NS.LookupNamespace('ovf'), $Property.Value)
|
||||||
} ElseIf ($Property.Value.Count -gt 1) {
|
} ElseIf ($Property.Value.Count -gt 1) {
|
||||||
ForEach ($Value in $Property.Value) {
|
ForEach ($Value in $Property.Value) {
|
||||||
$XMLValue = $XML.CreateElement('Value', $XML.DocumentElement.xmlns)
|
$XMLValue = $XML.CreateElement('Value', $XML.DocumentElement.xmlns)
|
||||||
|
|
||||||
$XMLValueAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.ovf)
|
# $XMLValueAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.ovf)
|
||||||
$XMLValueAttrValue.Value = $Value
|
# $XMLValueAttrValue.Value = $Value
|
||||||
$XMLValueAttrConfiguration = $XML.CreateAttribute('configuration', $XML.DocumentElement.ovf)
|
$XMLProperty.SetAttribute('value', $NS.LookupNamespace('ovf'), $Value)
|
||||||
$XMLValueAttrConfiguration.Value = $Value
|
# $XMLValueAttrConfiguration = $XML.CreateAttribute('configuration', $XML.DocumentElement.ovf)
|
||||||
|
# $XMLValueAttrConfiguration.Value = $Value
|
||||||
|
$XMLProperty.SetAttribute('configuration', $NS.LookupNamespace('ovf'), $Value)
|
||||||
|
|
||||||
[void]$XMLValue.Attributes.Append($XMLValueAttrValue)
|
# [void]$XMLValue.Attributes.Append($XMLValueAttrValue)
|
||||||
[void]$XMLValue.Attributes.Append($XMLValueAttrConfiguration)
|
# [void]$XMLValue.Attributes.Append($XMLValueAttrConfiguration)
|
||||||
|
|
||||||
[void]$XMLProperty.AppendChild($XMLValue)
|
[void]$XMLProperty.AppendChild($XMLValue)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user