Fix VM name;Fix cmdlet param;Purge scratch folder
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2021-02-13 22:07:01 +01:00
parent 961624998b
commit 8bf25b5f55
2 changed files with 12 additions and 6 deletions

View File

@ -218,12 +218,12 @@
"type": "shell-local", "type": "shell-local",
"inline": [ "inline": [
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\", "pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
" -OVFFile '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}.ovf' \\", " -OVFFile '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}-v.ovf' \\",
" -Parameter @{'appliance.name'='{{user `vm_guestos`}}';'appliance.version'='{{user `vm_name`}}'}\"", " -Parameter @{'appliance.name'='{{user `vm_guestos`}}';'appliance.version'='{{user `vm_name`}}'}\"",
"pwsh -file scripts/Update-Manifest.ps1 \\", "pwsh -file scripts/Update-Manifest.ps1 \\",
" -ManifestFileName '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}.mf'", " -ManifestFileName '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}-v.mf'",
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\", "ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
" '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}.ovf' \\", " '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}-v.ovf' \\",
" /output/Windows-Server-2019-LTSC.ova" " /output/Windows-Server-2019-LTSC.ova"
] ]
} }

View File

@ -27,12 +27,12 @@ $ConnectVIServerSplat = @{
Connect-VIServer @ConnectVIServerSplat | Out-Null Connect-VIServer @ConnectVIServerSplat | Out-Null
$GetVMSplat = @{ $GetVMSplat = @{
VM = "$($VMName)*" Name = "$($VMName)*"
ErrorAction = 'SilentlyContinue' ErrorAction = 'SilentlyContinue'
} }
If ([boolean](Get-VM @GetVMSplat)) { If ([boolean](Get-VM @GetVMSplat)) {
$RemoveVMSplat = @{ $RemoveVMSplat = @{
VM = "$($VMName)*" VM = Get-VM @GetVMSplat
DeletePermanently = $True DeletePermanently = $True
Confirm = $False Confirm = $False
ErrorAction = 'SilentlyContinue' ErrorAction = 'SilentlyContinue'
@ -42,4 +42,10 @@ If ([boolean](Get-VM @GetVMSplat)) {
Disconnect-VIServer * -Confirm:$False Disconnect-VIServer * -Confirm:$False
# Delete scratch folder contents $RemoveItemSplat = @{
Path = '/scratch/*'
Recurse = $True
Force = $True
Confirm = $False
}
Remote-Item @RemoveItemSplat