mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 02:35:46 +00:00
Fix New-NetboxVirtualMachine: Site is not mandatory, but site or cluster must be set
This commit is contained in:
parent
3abf2264d9
commit
e2697e7add
4 changed files with 6 additions and 8 deletions
|
|
@ -8,7 +8,6 @@ function New-NetboxVirtualMachine {
|
|||
[Parameter(Mandatory = $true)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Site,
|
||||
|
||||
[uint64]$Cluster,
|
||||
|
|
@ -45,8 +44,8 @@ function New-NetboxVirtualMachine {
|
|||
|
||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||
|
||||
if ($PSBoundParameters.ContainsKey('Cluster') -and (-not $PSBoundParameters.ContainsKey('Site'))) {
|
||||
throw "You must specify a site ID with a cluster ID"
|
||||
if (-not $PSBoundParameters.ContainsKey('Cluster') -and (-not $PSBoundParameters.ContainsKey('Site'))) {
|
||||
throw "A virtual machine must be assigned to a site and/or cluster."
|
||||
}
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Generated by: Ben Claussen
|
||||
#
|
||||
# Generated on: 01/09/2024
|
||||
# Generated on: 10/2/2024
|
||||
#
|
||||
|
||||
@{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Generated by: Ben Claussen
|
||||
#
|
||||
# Generated on: 01/09/2024
|
||||
# Generated on: 10/2/2024
|
||||
#
|
||||
|
||||
@{
|
||||
|
|
|
|||
|
|
@ -4502,7 +4502,6 @@ function New-NetboxVirtualMachine {
|
|||
[Parameter(Mandatory = $true)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Site,
|
||||
|
||||
[uint64]$Cluster,
|
||||
|
|
@ -4539,8 +4538,8 @@ function New-NetboxVirtualMachine {
|
|||
|
||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||
|
||||
if ($PSBoundParameters.ContainsKey('Cluster') -and (-not $PSBoundParameters.ContainsKey('Site'))) {
|
||||
throw "You must specify a site ID with a cluster ID"
|
||||
if (-not $PSBoundParameters.ContainsKey('Cluster') -and (-not $PSBoundParameters.ContainsKey('Site'))) {
|
||||
throw "A virtual machine must be assigned to a site and/or cluster."
|
||||
}
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue