Update logic to only allow install to attached devices
This commit is contained in:
@@ -5,8 +5,8 @@ $global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[
|
|||||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||||
|
|
||||||
Context "$global:function::Parameter Unit Tests" {
|
Context "$global:function::Parameter Unit Tests" {
|
||||||
it "$global:function should have exactly 22 parameters defined" {
|
It "$global:function should have exactly 22 parameters defined" {
|
||||||
(get-command $global:function).Parameters.Count | Should -Be 22
|
(Get-Command $global:function).Parameters.Count | Should -Be 22
|
||||||
}
|
}
|
||||||
|
|
||||||
$ParameterTestCases = @(
|
$ParameterTestCases = @(
|
||||||
@@ -35,7 +35,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
|||||||
'IpAddr' {
|
'IpAddr' {
|
||||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||||
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
|
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
|
||||||
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '^\$_ \-match \[IPAddress\]\$_'
|
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
|
||||||
}
|
}
|
||||||
|
|
||||||
$null {
|
$null {
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ function Install-ZertoVra {
|
|||||||
$identifier
|
$identifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($datastoreIdentifier.count -gt 1) {
|
||||||
|
Write-Error "Datastore $datastoreName has more than one identifier associated with it on the specified host. Please review and try again."
|
||||||
|
Break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build the JSON object through an Ordered Hashtable.
|
# Build the JSON object through an Ordered Hashtable.
|
||||||
@@ -71,7 +75,7 @@ function Install-ZertoVra {
|
|||||||
$vraBasic['VraNetworkDataApi'] = $vraBasicNetwork
|
$vraBasic['VraNetworkDataApi'] = $vraBasicNetwork
|
||||||
|
|
||||||
# Leverage WhatIf functionality to see what might happen, if WhatIf is not specified, attempt to install.
|
# Leverage WhatIf functionality to see what might happen, if WhatIf is not specified, attempt to install.
|
||||||
if ($PSCmdlet.ShouldProcess("Preforming operation 'Install-Vra' on Host $hostName with the following data \n $($vraBasic | convertto-json)")) {
|
if ($PSCmdlet.ShouldProcess("Preforming operation 'Install-Vra' on Host $hostName with the following data \n $($vraBasic | ConvertTo-Json)")) {
|
||||||
Invoke-ZertoRestRequest -uri "vras" -method POST -body $($vraBasic | ConvertTo-Json)
|
Invoke-ZertoRestRequest -uri "vras" -method POST -body $($vraBasic | ConvertTo-Json)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user