From 0f906dde0b696d6d76220a4d8e936f7e6a0dc8a3 Mon Sep 17 00:00:00 2001 From: Steve Horbachuk Date: Sat, 28 Mar 2020 09:08:37 -0400 Subject: [PATCH] Use IsPresent on switch, throw on Reject --- .../Public/catalog-service/Request-vRACatalogItem.ps1 | 6 +++--- .../Public/catalog-service/Request-vRAResourceAction.ps1 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Functions/Public/catalog-service/Request-vRACatalogItem.ps1 b/src/Functions/Public/catalog-service/Request-vRACatalogItem.ps1 index ca14c932..815f23ef 100644 --- a/src/Functions/Public/catalog-service/Request-vRACatalogItem.ps1 +++ b/src/Functions/Public/catalog-service/Request-vRACatalogItem.ps1 @@ -148,7 +148,7 @@ $Response = Invoke-vRARestMethod -Method POST -URI $URI -Body $JSON -Verbose:$VerbosePreference - if ($PSBoundParameters.ContainsKey("Wait")) { + if ($Wait.IsPresent) { While($true) { @@ -158,9 +158,9 @@ Write-Verbose -Message "State: $($Request.state)" - if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED") { + if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") { - if ($Request.state -Like "*FAILED") { + if ($Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") { throw "$($Request.requestCompletion.completionDetails)" diff --git a/src/Functions/Public/catalog-service/Request-vRAResourceAction.ps1 b/src/Functions/Public/catalog-service/Request-vRAResourceAction.ps1 index 32e6c834..64b3e363 100644 --- a/src/Functions/Public/catalog-service/Request-vRAResourceAction.ps1 +++ b/src/Functions/Public/catalog-service/Request-vRAResourceAction.ps1 @@ -137,7 +137,7 @@ function Request-vRAResourceAction { $ResponseId = ($Response.Headers.Location) -replace '^http.*requests/','' - if ($PSBoundParameters.ContainsKey("Wait")) { + if ($Wait.IsPresent) { While($true) { @@ -147,9 +147,9 @@ function Request-vRAResourceAction { Write-Verbose -Message "State: $($Request.state)" - if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED") { + if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") { - if ($Request.state -Like "*FAILED") { + if ($Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") { throw "$($Request.requestCompletion.completionDetails)"